Solved

vba for file FOLDER question

Posted on 2013-02-05
8
234 Views
Last Modified: 2013-02-05
vba excel 2010
Sorry I could not find a topic area for VBA.
These jpg's are for a excel project to view pics.


I have a folder:

C:\ITEM_JPG\

In this folder i have approx 989,000 jpg files...


They appear as:
1aa002.jpg
2eee44.jpg
10aa345.jpg
21aa355.jpg
41aa212.jpg
etc...


What I need:

I need to create a folder for jpg's that starts with "1" then nsme it "1_startswith"
then do the same up to "9"


Then cut and paste those files go under the appropriate the folders.

example:
anything that startwith "5"  will go under the
"5_startswith" folder.

anything that startwith "4"  will go under the
"4_startswith" folder.



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
  • 4
  • 4
8 Comments
 
LVL 26

Accepted Solution

by:
redmondb earned 500 total points
ID: 38856071
Hi, fordraiders.

(1) Save the attached file into the folder containing the files.
(2) Rename the file as Startswith.bat. (EE won't load batch files, so I made it a text.)
(3) Run it.

The batch file contains...
for %%a in (1 2 3 4 5 6 7 8 9 0) do md   "%%a_startswith"
for %%a in (1 2 3 4 5 6 7 8 9 0) do move "%%a*jpg" "%%a_startswith"

Open in new window

Regards,
Brian.Startswith.txt
0
 
LVL 3

Author Comment

by:fordraiders
ID: 38856213
batchfile...Thats different ...ok Thanks
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38856229
fordraiders,

With a million files involved there's a lot to be said for a solution that's efficient, effective and economical!

Regards,
Brian.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 3

Author Comment

by:fordraiders
ID: 38857400
ok i'm on windows 7 32bit ...been awhile since i ran a batch file
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38857435
While I wouldn't recommend anyone to spend time learning it now, it's hugely useful for one-off's like this.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 38857503
nm i got it to work...Worked perfect !
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 38857507
beautiful and simple to implement.
0
 
LVL 26

Expert Comment

by:redmondb
ID: 38857619
Now that's a compliment - many thanks, fordraiders!
0

Featured Post

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!

Question has a verified solution.

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

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

737 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