. modify.func //import each function
modify .suf1 .suf2 //call function
put the current directory All file names ending with .suf1 are modified to end with .suf2, such as: modify .pc .ec
Recursively implements the subdirectories of the subdirectories. . . .
#!/bin/bash
#modify.func
doit() //Process non-directory files in the current directory, ignoring directory files {oldname=`ls |
Grep "$1$"`for name in $oldnamedoif [ -d "$name" ]then :else#prename=`echo $name |
Awk -F\\. '{print $1}'` #old method has bugsprename=${name%.*} #new methodecho -e "$PWD/$name\\t\\t$newname"mv $name $newnamecount= `expr ${count} + 1`fidone
return 0}
do_recursive() //Starting from the current directory, recursively processing each directory {doit $1 $2
for Filename in `ls`doif [ -d "$filename" ]thencd $filenamedo_recursive $1 $2cd ..fidone
return 0}
modify() //Process the current directory and report As a result, this is equivalent to the main function, you can also directly call do_recursive{PARAMS=2if [ $# -ne $PARAMS ]thenecho "usage: mv_to .suf1 .suf2"return 1ficount=0do_recursive $1 $2echo "complete! $count files Have been modified."
return 0}
First of all, I would like to thank community enthusiasts and supporters for their attention to Linu
For the daily use of the Linux system, it is necessary to use the command line to carry out, for ex
For systems on the Internet, it is important to be clear about the situation: the network is not se
Download NetBeans Take netbeans-7.0beta2-ml-javaee-linux.sh as an example #sh netbeans-7.0beta2-ml-
Nginx self-starting file running error
Solve the boot problem of Linux and Windows dual system
Batch modify file (or folder) owner or permission
Solve the dual system boot option does not show the Linux system problem
About why Linux can be divided into 4 sectors.
Linux security mechanism detailed
U disk is not normal under Linux.
Linux command introduction: source usage
How does Linux solve system problems with fsck?
Operating system March market share latest ranking: Win7 first
WeChat small video can not shoot WeChat small video black screen reason tutorial
Win10 Mobile/PC device mystery button combination
Microsoft redesigned Win8's disk check and introduced four health models
How to hide files in win8? Win8 system to save the file to the picture tutorial
Win8 moves to ARM platform to strictly control application traffic
Win10 14393.187 update fixes which bug
How does the win7 system insert the excel formula in the word?
Solve the analysis of Vista system disk space tension
What should I do if the Win10 desktop right button opens the personalization settings?
How to open the win7 system screen saver mode win7 system set the screen saver mode