Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Script or free program to copy files in numerical order

Posted on 2008-10-20
3
Medium Priority
?
198 Views
Last Modified: 2012-05-05
hi, i am looking for a simple way to create an X number of copys of a file.
so that if i have one file named

filename0000.tif

i´d like to create x number of copys only call them filename0001.tif - filename9999.tif

any ideas ?
0
Comment
Question by:Hoddi1
  • 2
3 Comments
 
LVL 13

Assisted Solution

by:Brum07
Brum07 earned 600 total points
ID: 22756491
0
 
LVL 13

Accepted Solution

by:
Brum07 earned 600 total points
ID: 22756581
Sorry, forgot to tell you how to do it.

Use this VBScript to copy the file 1000 times;

set fso = CreateObject("Scripting.FileSystemObject")
For i = 1 to 1000
FSO.CopyFile "C:\temp\test.txt","C:\temp\test.txt" & i
Next

changing the locations as required, then use The Rename program to rename as needed.

Regards
0
 
LVL 38

Assisted Solution

by:Shift-3
Shift-3 earned 400 total points
ID: 22757760
Here is a way to do it in batch.

Paste the script below into a text file with a .cmd extension.  Running it will create copies numbered from 0001 to 9999.


@echo off
setlocal enabledelayedexpansion
 
set source=filename0000.tif
set base=filename
set ext=.tif
 
for /L %%G in (1,1,9999) do (
 set num=000%%G
 set num=!num:~-4!
 echo F|xcopy "%source%" "%base%!num!%ext%" /C /H /R /Y
)

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This is a fine trick which I've found useful many times, when you just don't want to accidentally run a batch script or the commands needs administrator rights.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

782 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