[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

vba for file FOLDER question

Posted on 2013-02-05
8
Medium Priority
?
242 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 2000 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
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: 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

656 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