Solved

copying files from one folder to another with specifics requirements

Posted on 2014-01-16
6
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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