[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

copying files from one folder to another with specifics requirements

Posted on 2014-01-16
6
Medium Priority
?
256 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 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
Technology Partners: 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 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