|

楼主 |
发表于 2005-12-10 13:21:55
|
显示全部楼层
呵呵,发现mkdir -p的功能后,挺简单的
#!/bin/sh
if [ $# != 3 ]
then
echo "To get the file for the source directory, stores them in the destination directory."
echo "Keeping the structure of directory"
echo "Usage: $0 src_dir dest_dir file_name"
exit
fi
mkdir -p $2
cd $1
for i in $(find -name $3)
do
echo $i
mkdir -p $2/`dirname $i`
cp $i $2/$i
done |
|