[CentOS] Fixing filenames with directories with spaces in the names

Bob Marcan bob.marcan at gmail.com
Fri Dec 31 12:34:58 UTC 2010


On Mon, 27 Dec 2010 22:03:49 -0700
Craig White <craigwhite at azapple.com> wrote:

> Should be simple and perhaps I'm tired but it's not coming to me.
> 
> In its simplest form...
> 
> for old in `cat "$FILENAME"`;do
>   echo "$old"
>   dirname "$old"
>   new="$(echo $old | sed 's/\*/\-/')"
> done
> 
> I'm trying to take out some stupid Macintosh things - in this case
> filenames with asterisks but I have others like tilde's and probably
> others that I haven't come across.

Another way:
Installed Packages
Name        : detox
Arch        : x86_64
Version     : 1.2.0
Release     : 2.fc14
Size        : 135 k
Repo        : installed
From repo   : fedora
Summary     : Utility to replace problematic characters in file names
URL         : http://detox.sourceforge.net
License     : BSD
Description : Detox is a utility designed to clean up file names. It replaces difficult to
            : work with characters, such as spaces, with standard equivalents. It will also
            : clean up file names with UTF-8 or Latin-1 (or CP-1252) characters in them.

BR, Bob



More information about the CentOS mailing list