Solved

Script to copy and name file multiple times

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

749 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