Copying files multiple times increasing sequentially


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copying files multiple times increasing sequentially
# 1  
Old 03-26-2009
Copying files multiple times increasing sequentially

I am looking for the easiest way to copy a set of files 1000 times and increment sequentially.

I want to copy these 2 files:
Scenario.1.1.ud
Scenario.1.2.ud

So that it creates the following:
Scenario.2.1.ud
Scenario.2.2.ud
Scenario.3.1.ud
Scenario.3.2.ud
..
..
Scenario.1000.1.ud
Scenario.1000.2.ud

Any suggestions? Thanks.
# 2  
Old 03-26-2009
#!/bin/ksh

i=2
file1=Scenario.$i.1.ud
file2=Scenario.$i.2.ud

i=2
while [ $i -le 1000 ];do
file1=Scenario.$i.1.ud
file2=Scenario.$i.2.ud
cp Scenario.1.1.ud $file1
cp Scenario.1.2.ud $file1

i=$(( $i + 1 ))
done

echo " 100 files copied"
# 3  
Old 03-26-2009
amitranjansahu

Great, thanks for your help.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying the files in to multiple location using shell script

Hi All, i'm trying to copy the 1.txt files (sample files) in to different path location using the below command. But it is not copying the files , when i tried for single location able to copy the file. can any one please assist here. Please find the below path :- /ckr_mkr1/licencekey... (2 Replies)
Discussion started by: venkat918
2 Replies

2. Shell Programming and Scripting

Copying multiple files and appending time stamp before file extension

Hi, I have multiple files that read: Asa.txt Bad.txt Gnu.txt And I want to rename them using awk to Asa_ddmmyytt.txt and so on ... If there is a single command or more efficient executable please share! Thanks! (4 Replies)
Discussion started by: Jesshelle David
4 Replies

3. Shell Programming and Scripting

Sequentially rename multiple files

Hello team, We wish to develop a script as follows : 1. Rename multiple files in the following way: example Original file names : test.txt and dummy.txt New file names : test.$(date +"%F").AAAAA<serialno_1>.BBBBBB.p and dummy.$(date +"%F").AAAAA<serialno_2>.BBBBBB.p 2. The... (3 Replies)
Discussion started by: H squared
3 Replies

4. Shell Programming and Scripting

Copying Multiple Files into a Subdirectory

Hello, I'm very new to scripting languages and I'm to use shell script to write a utility to backup files with a specific extension into a subdirectory. Here is what I have done. #!/bin/bash read -p "Enter file(s) extension: " FILE if ; then mkdir `whoami`.$FILE #To... (9 Replies)
Discussion started by: alphanoob
9 Replies

5. Shell Programming and Scripting

Finding BEGINNING & ENDING positions of sequentially increasing sublists from a perl numeric array

I have got an Perl array like: @array = (1,2,3,4,5,6,1,2,3,4,1,2,1,2,3,4,5,6,7,8,9...............) This numeric sequence will be always sequentially increasing, unless it encounters, The beginning of the new sequentially increasing numeric sequence. SO in this array we get sequentially... (5 Replies)
Discussion started by: teknokid1
5 Replies

6. UNIX for Dummies Questions & Answers

copying same file multiple times with different names

hi, I am copying a file from 1 folder to another in /bin/sh. if the file already exists there, it should get copied as filename1. again if copying next time it shouldget copied as filename2.. , filename3..so on.. The problem is i am able to get uptil filename1.. but how do i know what... (6 Replies)
Discussion started by: blackcat
6 Replies

7. UNIX for Dummies Questions & Answers

Help in copying multiple files from th directory

Hey Guys, I have directory with thousands of files, I need to copy only march data. can any one please Help.......... Thanks, Uttam N (4 Replies)
Discussion started by: Uttamnsd
4 Replies

8. Shell Programming and Scripting

Copying multiple csv files

Hi, I have mutiple csv files at server1 at /apps/test/data. I needed a script that would copy these csv files from server1 at /usr/data, put them in server2,archive the earlier files that were present in server2 before removing those already present. Kindly help. (2 Replies)
Discussion started by: Alok Ranjan
2 Replies

9. UNIX for Dummies Questions & Answers

copying multiple files

We want to copy the data from all the files SPR_201103* to AMGEN. We tried the following command cp $AGENT_DATA/amgen/SPR_201103* $AGENT_DATA/AMGEN amgen is directory . AMGEN is file we are trying to creat. for SPR_201103* 10 files are there Please help me to how to achive this.... (2 Replies)
Discussion started by: ajaykumarkona
2 Replies

10. Shell Programming and Scripting

Synchronization in copying multiple files to a directory

Hi Friends, My goal is to copy 1000 of files of same filesize simultaneously to a directory. i.e i do multiple copies into a same directory. What i feel here is, at some 1000th iteration, few transfers ends in advance before some transfers start. I need to get synchronized file transfers so that... (1 Reply)
Discussion started by: amio
1 Replies
Login or Register to Ask a Question