Solved

copying files from one folder to another with specifics requirements

Posted on 2014-01-16
6
249 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

by:fordraiders
Comment Utility
OK thanks..will let you know
0
 
LVL 3

Author Closing Comment

by:fordraiders
Comment Utility
this script worked like a charm...Thanks
0
 
LVL 26

Expert Comment

by:pony10us
Comment Utility
Glad I could help.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello again, all.  For those of you that have been following along, you'll know that this is my third article on this topic (though it is not Part III).  This article is sort of remedial, and probably the topic with which I should have started the s…
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now