Link to home
Start Free TrialLog in
Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on

Copying jpeg files located in different folders using an Excel macro

Dear Experts:

I got thousands of jpeg files nested into subfolders such as:

C:\Catalogue\MyGraphics\10\10-150\10-150-00-07\JPEG\10-150-00-07.jpg
C:\Catalogue\MyGraphics\10\10-170\10-170-00-07\JPEG\10-170-00-07.jpg
C:\Catalogue\MyGraphics\20\20-190\20-190-00-08\JPEG\20-190-00-08.jpg
etc.

I wonder whether an Excel macro is capable of looping through all these subfolders and copy all the jpg-files into a folder on Drive D with the following path: D:\My_JPEG_Graphics\

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

Regards, Andreas
Avatar of tel2
tel2
Flag of New Zealand image

Hi AndreasHermle,

I'm not planning to answer this question, but I think it would be good for you to state why you want this done in Excel, and whether you would mind having a batch file or PowerShell script instead, because they are probably more appropriate.  Also, is this to be for one-off or regular use?

Thanks.
Avatar of Andreas Hermle

ASKER

Hi tel,

thank you very much for your swift response.

If a batch file or PowerShell script is able to tackle this task, the better. In the past I got so many tasks done by running an excel macro (creating folders from cell entries, deleting specific files in the operating system etc.), that I thought that my current problem could also be solved by running an excel macro.

Hence if my macro requirements do not exceed the scope of this forum, it would be great if you could come up with some type of batch file for my task.

Thank you very much

Regards, Andreas
Hi tel,

I forgot to tell you that this will be for regular use.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi sktneer,

thank you very much for your post. I will do the testing this evening and then get back to you with a feedback.

Regards, andreas
Wow, sktneer, I am really deeply impressed. An initial test produced the desired results.

I will do some more testing, but I am sure subsequent tests will produce the same results.

Again thank you very much for your professional help. I really appreciate it.

Regards, Andreas
Hi sktneer, this is really a superb code which saves me hours and days of work. I am so glad.

Thank you very much for your great, swift and professional help. I really appreciate it.

Regards, Andreas
Glad to help.
Avatar of [ fanpages ]
[ fanpages ]

Andreas:

Sorry I missed your question.

My solution (in response to your previous question about deleting folders) could easily have been modified to copy the files:

[ https://www.experts-exchange.com/questions/28694077/Delete-multiple-subfolders-in-Windows-Explorer-using-Excel-VBA-Excel-2010-running-on-Windows-7-Enterprise.html?anchorAnswerId=40862801#a40862801 ]
Hi fanpages,

sorry for not getting back to you earlier. Thank you very much for this follow-up, this is very kind.

Would that be asking too much if you could modify the code to accommodate the new requirements as you suggested in your post? It would be great to have another approach ;-)

Kind regards, Andreas