?
Solved

copying files from one folder to another with specifics requirements

Posted on 2014-01-16
6
Medium Priority
?
257 Views
Last Modified: 2014-01-22
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
0
Comment
Question by:Fordraiders
  • 3
  • 3
6 Comments
 
LVL 26

Expert Comment

by:pony10us
ID: 39786711
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

0
 
LVL 3

Author Comment

by:Fordraiders
ID: 39786761
batch will do fine...actually...will try it..

how does it know i'm copying from :
in a  folder called :
D:\Images_2014\
0
 
LVL 26

Accepted Solution

by:
pony10us earned 2000 total points
ID: 39786793
You would either run from within that folder or change line 3 to:

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

Open in new window

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Fordraiders
ID: 39786812
OK thanks..will let you know
0
 
LVL 3

Author Closing Comment

by:Fordraiders
ID: 39800735
this script worked like a charm...Thanks
0
 
LVL 26

Expert Comment

by:pony10us
ID: 39800844
Glad I could help.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question