|
楼主 |
发表于 2009-6-28 13:38:45
|
显示全部楼层
done
steves-power-mac-g5:~/Desktop/desktop-tst guest$ cat filerename.awk
#! /usr/bin/awk -f
BEGIN {
print "#! /bin/bash -f \n"
}
# main
{
i = split($9, I, "/")
t = $8
sub(/\:/, "-", t)
print "cp -p " $9 " ./merged/" $6 "-" $7 "_" t "-" I[ i]
}
steves-power-mac-g5:~/Desktop/desktop-tst guest$ cat go.sh
#! /bin/bash -f
find . -type f -name "IMG_*.JPG" | xargs ls -l > list.txt
awk -f filerename.awk list.txt > renamecopy.sh
chmod +x renamecopy.sh
touch merged
rm -r merged
mkdir merged
./renamecopy.sh
ls -l merged > merged/filelist.txt
mv list.txt merged/originallist.txt
cat merged/filelist.txt
rm renamecopy.sh
steves-power-mac-g5:~/Desktop/desktop-tst guest$
[ 本帖最后由 DigiPub 于 2009-6-28 13:41 编辑 ] |
|