Get in touch!Get in touch!

Copy one file to multiple other files

This script copies one file to multiple other files according to a list given in a text file. For example, say we have a drawing template for one road, and we wanna reproduce the template to 12 other roads, and the file-names of these 12 roads are given in a text file.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
 
###############################################################
# This script copies one file to multiple other files according
# to a list given in a text file.
 
# For example, say we have a drawing template for one road, and we
# wanna reproduce the template to 12 other roads, and the
# filenames of these 12 roads are given in a text file.
 
# adapted from http://stackoverflow.com/questions/18243957/copy-few-files-from-a-directory-that-are-specified-in-a-text-file-linux
 
###############################################################
# @author Victor Miti <[email protected]>
# @date 2014-July-19
###############################################################
 
cat filenames.txt | xargs -I FILES cp cross-sections_template_Main-St.dwt FILES
 
############################################################### 
#!/bin/sh

###############################################################
# This script copies one file to multiple other files according
# to a list given in a text file.

# For example, say we have a drawing template for one road, and we
# wanna reproduce the template to 12 other roads, and the
# filenames of these 12 roads are given in a text file.

# adapted from http://stackoverflow.com/questions/18243957/copy-few-files-from-a-directory-that-are-specified-in-a-text-file-linux

###############################################################
# @author Victor Miti <[email protected]>
# @date 2014-July-19
###############################################################

cat filenames.txt | xargs -I FILES cp cross-sections_template_Main-St.dwt FILES

############################################################### 


Comments are closed.