解密:
find -name "*" -type l -exec bash cpfile.sh '{}' '../outfiles' \;
拷贝链接文件:
find -name "*" -type l -exec bash cplink.sh '{}' '../outfiles' \;
重命名:
find -name "*.outx.iso" -type l -exec bash mvfile.sh '{}' '.outx.iso' \;
cpfile.sh
#!/bin/bash path1=`echo ${1:2}` # ##if dir not exist create it; if [ ! -d $2 ];then mkdir -p "$2" fi path2="$2"/"$path1" # echo $alldir alldir=`dirname "$path2"` # echo "$alldir" if [ ! -d $alldir ];then mkdir -p "$alldir" fi ##cp link to new dir cat "$1" > "$path2"".outx.iso" # echo "end"
cplink.sh
#!/bin/bash path1=`echo ${1:2}` # echo $path1 path2="$2"/"$path1" # echo $alldir alldir=`dirname "$path2"` # echo "$alldir" if [ ! -d $alldir ];then mkdir -p "$alldir" fi ##cp link to new dir cp -d "$1" "$path2" # echo "end"
mvfile.sh
cat mvfile.sh #!/bin/bash ##filname: mvfile.sh --- path1=`echo ${1:2}` # echo $alldir rename=${path1%"$2"} #echo "$rename" ##rename path1 to $rename mv "$path1" "$rename" # echo "end"