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
Solved

Script to copy and name file multiple times

Posted on 2009-05-15
2
881 Views
Last Modified: 2012-06-22
I need to copy and rename one file multiple times.
Let's say the file name is StartFile.jpg
I would like to copy StartFile.jpg, rename it to
1000a.jpg
1000b.jpg
1000c.jpg
1000d.jpg
1000e.jpg
1001a.jpg
1001b.jpg
1000c.jpg
etc...all the way to 2000e.jpg

Any ideas on how to do something like that?

0
Comment
Question by:abenage
2 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 24398701
Dim fso, fil, Counter

Set fso = CreateObject("Scripting.FileSystemObject")
Set fil = fso.GetFile("c:\folder\subfolder\StartFile.jpg")

For Counter = 1000 To 2000
    fil.Copy "c:\folder\subfolder\" & Counter & "a.jpg"
    fil.Copy "c:\folder\subfolder\" & Counter & "b.jpg"
    fil.Copy "c:\folder\subfolder\" & Counter & "c.jpg"
    fil.Copy "c:\folder\subfolder\" & Counter & "d.jpg"
    fil.Copy "c:\folder\subfolder\" & Counter & "e.jpg"
Next

Set fil = Nothing
Set fso = Nothing
0
 
LVL 1

Author Closing Comment

by:abenage
ID: 31582059
Awesome!

Thanks.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

839 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