转换文件名中空格为下划线(借鉴他人经验)

#!/bin/bash find . -name "* *" | while read name; do na=$(echo $name | tr ' ' '_') mv "$name" $na done #!/bin/bash #Replace all spaces in the files in current directory and subfolder with #underline. for x in `ls -R`; do mv "$x" `echo -n $x | tr " " "_"`; done

 

 

感谢:http://blog.chinaunix.net/u/11598/showart_1921157.html

http://blog.csdn.net/sabalol/archive/2009/11/12/4804607.aspx

你可能感兴趣的:(转换文件名中空格为下划线(借鉴他人经验))