Solved

Script to copy and name file multiple times

Posted on 2009-05-15
2
847 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
The viewer will learn how to dynamically set the form action using jQuery.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now