Difference between revisions of "Removing spaces from filenames"
From thelinuxwiki
(Pushed from Themanclub.) |
(Pushed from Themanclub.) |
||
Line 1: | Line 1: | ||
Remove all spaces from all files in current directory: | Remove all spaces from all files in current directory: | ||
− | Shell one-liner IFS=$'\n';for f in `find .`; do file=$(echo $f | tr [:blank:] '_'); [ -e $f ] && [ ! -e $file ] && mv "$f" $file;done;unset IFS Script IFS=$'\n' for f in `find .`; do file=$(echo $f | tr [:blank:] '_') [ -e $f ] && [ ! -e $file ] && mv "$f" $file done unset IFS | + | Shell one-liner |
+ | |||
+ | <p>IFS=$'\n';for f in `find .`; do file=$(echo $f | tr [:blank:] '_'); [ -e $f ] && [ ! -e $file ] && mv "$f" $file;done;unset IFS Script IFS=$'\n' for f in `find .`; do file=$(echo $f | tr [:blank:] '_') [ -e $f ] && [ ! -e $file ] && mv "$f" $file done unset IFS </p> | ||
[[Category:Linux]] | [[Category:Linux]] |
Revision as of 15:46, 24 May 2013
Remove all spaces from all files in current directory:
Shell one-liner
IFS=$'\n';for f in `find .`; do file=$(echo $f | tr [:blank:] '_'); [ -e $f ] && [ ! -e $file ] && mv "$f" $file;done;unset IFS Script IFS=$'\n' for f in `find .`; do file=$(echo $f | tr [:blank:] '_') [ -e $f ] && [ ! -e $file ] && mv "$f" $file done unset IFS