homepage Welcome to WebmasterWorld Guest from 54.166.8.138
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Way to make multiple copies of same file like this?
anon123




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

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

But I wanted it copied and renamed like this:

1Filename.txt
2Filename.txt
3Filename.txt

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.

 

coopster




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

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

anon123




msg:3556346
 10:58 pm on Jan 23, 2008 (gmt 0)

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.

anon123




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

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:

18502Filename.txt
18503Filename.txt
18504Filename.txt

etc.

Rather than:

1Filename.txt
2Filename.txt
3Filename.txt

etc.

coopster




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

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

anon123




msg:3557031
 5:13 pm on Jan 24, 2008 (gmt 0)

Works beautifully, thanks so much coop!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved