Computing.Net > Forums > Programming > Copy a File X number of times

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Copy a File X number of times

Reply to Message Icon

Name: James More
Date: May 10, 2009 at 19:40:36 Pacific
OS: Windows 2003
Subcategory: Batch
Comment:

I have a file that I would like to make X amount of copies of, I could copy and paste the file 200 times but I need to name these files

message1.xml
message2.xml

The original file is called message.xml

Could I some how do a loop ?



Sponsored Link
Ads by Google

Response Number 1
Name: Valerie (by Garibaldi)
Date: May 10, 2009 at 20:21:54 Pacific
Reply:

Not tested.

For /l %%1 in (1,1,200) do (
    copy message.xml message%%1.xml > nul
)

Or:

 For /l %%1 in (1,1,%1) do (
   copy message.xml message%%1.xml > nul
)

The first script would copy the file 200 times, the second would copy the file the number of times which you enter at the command line.

Good luck


0
Reply to Message Icon

Related Posts

See More


Windows XP failed applica... Running multiple bat file...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Copy a File X number of times

delete x number of lines from a CSV file www.computing.net/answers/programming/delete-x-number-of-lines-from-a-csv-file/19820.html

Batch file: Count instances of a word www.computing.net/answers/programming/batch-file-count-instances-of-a-word/19684.html

Copy a file to system32 folder of multiple co www.computing.net/answers/programming/copy-a-file-to-system32-folder-of-multiple-co/19810.html