Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

copying files from one folder to another with specifics requirements

excel 2010 vba
vba code needed please

I have image files ina  folder called :
D:\Images_2014\

I also have images on the C:\  drive: with folder structure

C:\Images_2014\<SUBFOLDERS>
1_JPG\
2_JPG\
3_JPG\
4_JPG\
5_JPG\
6_JPG\
7_JPG\
8_JPG\
9_JPG\

What I need:

From the  D:\Images_2014\  
If a .jpg file starts with say  "1" THEN IT GETS PLACED INTO THE:
C:\Images_2014\1_jpg    folder
Example:
1A1221.JPG


If a .jpg file starts with say  "2" THEN IT GETS PLACED INTO THE:
C:\Images_2014\2_jpg    folder
Example:
2AW123.JPG

etc... etc...


Thanks
fordraiders
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America image

Does it have to be VBA or will Batch work?  

Here it is the batch file:

rem @echo off

for /l %%i in (1,1,10) do copy %%i*.jpg c:\Images_2014\%%i_jpg\

echo copy complete
pause

Open in new window

Avatar of Fordraiders

ASKER

batch will do fine...actually...will try it..

how does it know i'm copying from :
in a  folder called :
D:\Images_2014\
ASKER CERTIFIED SOLUTION
Avatar of Steven Carnahan
Steven Carnahan
Flag of United States of America 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
OK thanks..will let you know
this script worked like a charm...Thanks
Glad I could help.