Reputation: 151
I would like do this in a script task. For example i would like to be able to do something like this:
For each file as file in strDirectory
file.delete
next file
Upvotes: 2
Views: 6999
Reputation: 13640
Why do this in a script task? The File System task has the ability to Delete Directory Content without having to program a Script Task.
Upvotes: 7
Reputation: 1140
using System.IO;
foreach (FileInfo f in new DirectoryInfo("c:\dir").GetFiles())
f.Delete();
Upvotes: 1
Reputation: 168988
For Each file As String In Directory.GetFiles(strDirectory)
File.Delete(file)
Next
Upvotes: 2