Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

Way to make multiple copies of same file like this?

10:02 pm on Jan 23, 2008 (gmt 0)

5+ Year Member

Hello, I have 1 file that I need to make 1000 copies of.

But I wanted it copied and renamed like this:


Etc. up to 1000.

It's pretty easy to make 1000 copies of the same file, but it messes up how it is named.

They end up looking like this: Copy 1 of Filename.txt, Copy 2 of Filename.txt, etc.

Does anyone know a way to do this?

I've downloaded a file re-namer utitlity, but it doesn't make copies of the file, just re-names files you already have.

10:30 pm on Jan 23, 2008 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Is that Windows you are using? If so, you can either change to the working directory or use the full directory in the command as follows ...
C:\>for /L %f in (1,1,1000) do copy C:\Temp\1Filename.txt C:\Temp\%fFilename.txt
10:58 pm on Jan 23, 2008 (gmt 0)

5+ Year Member

Hi coopster, thanks for the reply.

I am using windows, yes.

I actually just used what I said above as an example, but am wishing I said exactly what I need now, lol.

I'm actually only making 59 copies of 1 file.

It starts at 18502Filename.txt

And I need that same file copied and to go up to 18560Filename.txt.

I know it probably would only probably take me about 10 minutes to just make 59 copies of the file and manually re-name them, but we have to do this on a pretty regular basis and I'm just looking for an easier way.

With that said, could I still use a similar code to what you have there? Couldn't quite figure it out.

11:56 pm on Jan 23, 2008 (gmt 0)

5+ Year Member

I tinkered with the command, and it works.

But I can't quite figure out how to make it start at 18502 and go up from there.

Just had to change the "1000" part to 59 and it made 59 copies.

But I want the copy numbers to go:



Rather than:



5:16 am on Jan 24, 2008 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

For reference, I cut/paste this right out of the MS help:

Use an iterative variable to set the starting value (start#) and then step through a set range of values until the value exceeds the set ending value (end#). /L will execute the iterative by comparing start# with end#. If start# is less than end# the command will execute. When the iterative variable exceeds end# the command shell exists the loop. You can also use a negative step# to step through a range in decreasing values. For example, (1,1,5) generates the sequence 1 2 3 4 5 and (5,-1,1) generates the sequence (5 4 3 2 1)). The syntax is:

for /L {%% ¦ %} variable in (start#,step#,end#) do command[CommandLineOptions]

Therefore ...

C:\>for /L %f in (18502,1,18560) do copy C:\Temp\18502Filename.txt C:\Temp\%fFilename.txt
5:13 pm on Jan 24, 2008 (gmt 0)

5+ Year Member

Works beautifully, thanks so much coop!

Featured Threads

Hot Threads This Week

Hot Threads This Month