A large number of files are required for testing, so a script is written to copy. A regular file name facilitates reference.
Copy Code code as follows:
#!/bin/sh
# file Name:batchcp.sh
# Author:zhouhh
# email:ablozhou@gmail.com
# date:2008.3.31
echo "Input your file name"
Read FILENAME
echo "How many times do you want copy?"
Read times
echo "Your file name is ${filename} and you are want to copy ${times}."
Base= ' echo ${filename}|cut-d '. "-F 1"
Ext= ' echo ${filename}|cut-d '. "-F 2"
For ((i=0;i<${times};i++))
Todo
echo "Copy ${base}.${ext} to ${base} $i. ${ext} ..."
CP "${base}.${ext}" "${base} $i. ${ext}"
Done
Another version
Copy Code code as follows:
#!/bin/sh
# file Name:batchcp.sh
# Author:zhouhh
# email:ablozhou@gmail.com
# date:2008.3.31
echo "Input your file name"
Read FILENAME
echo "How many times do you want copy?"
Read times
echo "Your file name is ${filename} and you are want to copy ${times}."
#find. And cut the left part of the file name using # #
ext=${filename##*.}
#find. And cut the right part of the file name using%
base=${filename%.*}
echo "Base: $BASE"
echo "Ext: $EXT"
For ((i=0;i<${times};i++))
Todo
echo "Copy ${base}.${ext} to ${base} $i. ${ext} ..."
CP "${base}.${ext}" "${base} $i. ${ext}"
Done