Link to home
Create AccountLog in
Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on

Delete jpg-files in nested folders using VBA

Dear Experts:

below code deletes all jpg-files that are located in the Folder names 'Test'

How is this code to be re-written, so that nested folders (subfolders and sub-subfolders etc, i.e C:\Test\Subfolder\etc.) that are located within C:\Test\ are also get worked on.

Help is much appreciated. Thank you very much in advance.

Regards, Andreas


Sub Delete_JPG_Files_Folder()
     On Error Resume Next
    Kill "C:\Test\*.jpg"
    On Error GoTo 0
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Andreas Hermle

ASKER

Hi Rory:

I will give a try when I am back at my working place.  

Thank you very much for your great help.

Regards, Andreas
Hi rory,

I am truly impressed! Great job, thank you very much for your professional help.

Saves me lots and lots of time.

Regards, Andreas