Return to Snippet

Revision: 55144
at January 28, 2012 17:42 by licensetoil


Initial Code
alias rm_whitespace="for F in * ; do NF=\`echo \$F | perl -lne \"s/ /-/g; s/\_/-/g; s/[,']//g; s/[-]+/-/g; print\"\` ; mv \"\$F\" \"\$NF\" ; done"

Initial URL
http://snipplr.com/view/4468/batch-rename-files-in-directory/

Initial Description
Add this to your .profile or .bash_rc file, source the file, navigate to the directory and call "rm_whitespace"

Based on: http://snipplr.com/view/4468/batch-rename-files-in-directory/

Initial Title
Batch remove whitespace in all the files in directory and replace with a dash "-"

Initial Tags
unix, files, perl

Initial Language
Bash