How to delete all the files in the specified folder?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

by meanse of System.IO namespace?
(The task is being doing easily by screepting runtime.)

Thanks in advance.
 
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string fileName in fileEntries)
{
File.Delete(Path.Combine(targetDirectory, fileName));
}
 
I said "all the files in the specified folder", that means the file names are
unknown.
It must be something like for each... in the folder.
Is it possible?

Thanks in advance.


Vadym Stetsyak said:
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string fileName in fileEntries)
{
File.Delete(Path.Combine(targetDirectory, fileName));
}

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

Ivan Abramov said:
by meanse of System.IO namespace?
(The task is being doing easily by screepting runtime.)

Thanks in advance.
 
Oh, sorry, Vadym,
I'm blind, of cause, it's ok.

Greate thanks.


Vadym Stetsyak said:
string [] fileEntries = Directory.GetFiles(targetDirectory);
foreach(string fileName in fileEntries)
{
File.Delete(Path.Combine(targetDirectory, fileName));
}

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

Ivan Abramov said:
by meanse of System.IO namespace?
(The task is being doing easily by screepting runtime.)

Thanks in advance.
 
Back
Top