Saturday, July 19, 2008

Removing spaces from file names!

The following script, which I found here after an hour of googling, can be used to remove spaces and replacing them with any character (like '_') from file names

$ for f in *; do
> file=$(echo $f | tr ' ' _)
> [ ! -f $file ] && mv "$f" $file
> done
$

No comments: