Below code deletes all png files located in the folder "C:\Test\"
Could somebody please rewrite the code that the following requirements are met:
- nested subfolders under C:\Test\ should also be worked on
- all png-files should be deleted with the exception of file names with the following make-up: ##-###-##-##.png (e.g. 90-434-22-43.png or 55-234-55-07.png)
- will the below and revised code run on 64 bit windows Systems as well?
Help is much appreciated. Thank you very much in advance.
Dim fs As FileSystemObject
Dim f As Object
Dim strFileName As String
Const strPath As String = "C:\Test\" 'The folder with the files
Set fs = CreateObject("Scripting.FileSystemObject")
strFileName = Dir$(strPath & "*.png")
While Len(strFileName) <> 0
Set f = fs.GetFile(strPath & strFileName)
Kill strPath & strFileName
strFileName = Dir$()
Set f = Nothing
Set fs = Nothing