[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Maybe offtopic: Dealing with filenames with blanks in a script



>>>>> "Richard" == Richard Lyons <richard@the-place.net> writes:

    > Does that mean I could have a script to convert all those
    > horrible filenames people give you from the dark side - the
    > ones like "Some Thoughts About Your Proposition.doc".  A
    > simple script to replace all the spaces with underscores.

#!/bin/bash
# Replace spaces with underscores in filenames.

for file in *\ *; do 
    newfile=`echo "${file}" | tr " " _`
    mv -iv "$file" $newfile
done



Reply to: