We help IT Professionals succeed at work.
Get Started

delete specific jpg files from folders and subfolders using Excel VBA

Andreas Hermle
Last Modified: 2016-02-11
Dear Experts:

I understand that it is possible to delete files from a folder using Excel VBA

I am running Excel 2010 on Windows 7

I would like to delete specific jpg files from a directory with many folders and subfolders. The directory's name is ...
... C\Graphics\...

The jpg files that are to be deleted are only those that have the following characters at the end:

_h.jpg or _n.jpg, i.e. for example 90-147-58-30_h.jpg or 94-111-24-39_n.jpg. All other jpg files that do not match these criteria are not to be touched.

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

Kind regards, Andreas
Watch Question
Microsoft Excel Expert
Top Expert 2014
This problem has been solved!
Unlock 2 Answers and 13 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE