a.批量处理文件名进行查找 : filemovescript #!/bin/bash source_dir=$1 target_dir=$2 cd $source_dir for realfile in * do file=`echo $realfile | sed -e 's/ //g'` a=`echo $file | awk -F- '{print $1}'` b=`echo $file | awk -F- '{print $2}'` c=`echo $file | awk -F- '{print $3}'` mv_dir="$target_dir/$a/$b/$c" if [ ! -d $mv_dir ] ; then mkdir -p $mv_dir fi mv "$source_dir/$realfile" $mv_dir echo "mv "$source_dir/$realfile" $mv_dir" >> "$target_dir/move.log" done b.批量文件查找 : find_seperate_move #!/bin/bash cat $1 | while read line; do if [ -f "$line" ];then echo "fine $line" echo "find $line" >> "/move.log" echo "cp "$line" "$2"" >> "/move.log" cp "$line" "$2" else echo "can't find $line" echo "can't find $line" >> "/move.log" fi done c.批量添加文件后缀 : file_add_suffix #!/bin/bash source_file=$1 cat $source_file | while read line; do echo $line.rpm >> /result done d.ftp批量下载 : ftp_filedownload_change.sh #!/bin/bash ftp -nv<<! open (ip_address) user (user_name) (user_passwd) binary hash prompt off cd (ftp_dir) lcd (local_dir) mget * close bye ! e.批量删除后缀名 : delete_suffix.sh #!/bin/bash for file in * do file=${file%.*} echo $file done e.批量删除后缀名 : extrac_suffix.sh #!/bin/bash for file in * do file=${file#*.} echo $file done