?
Solved

Script to copy and name file multiple times

Posted on 2009-05-15
2
Medium Priority
?
903 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
[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
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
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…
Suggested Courses

770 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