Hello
I'd like to ask how can i delete all files in a specific directory which contains a specific string?
Would you please post a code for that?
Thanks
Cheers
Adel
Printable View
Hello
I'd like to ask how can i delete all files in a specific directory which contains a specific string?
Would you please post a code for that?
Thanks
Cheers
Adel
Are these all text files?
yes, they are all text files
I meant that they contain specific string in their names.. sorry i was not very clear
Code:Dim FolderName As String
Dim PartOfFileName As String
Dim FileName As String
FolderName = "C:\YourFolder\"
PartOfFileName = "abcxyz"
FileName = Dir(FolderName & "*" & PartOfFileName & "*.*")
Do While FileName <> ""
Kill FolderName & FileName
FileName = Dir()
Loop
Thanks it works like a charm