|
There are some files and directories under the current directory, where each directory has a number of .txt files,
Now asked to create a new directory all in the current directory, and the directory of all those .txt files
They are copied to the directory all. In Ubuntu 12.04 the shell script to achieve the following:
#! / Bin / sh
# Message
echo "start:"
# Define variables
dst = all
pst = .txt
# Copy the files to the destination folder
if [-d $ {dst}]
then
echo "$ {dst} existed"
else
echo "mkdir $ {dst}"
mkdir ./${dst}
cp ./*/*$pst ./$dst
fi |
|
|
|