help-make
[Top][All Lists]
Advanced

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

Re: whitespace in filenames


From: Louis-David Mitterrand
Subject: Re: whitespace in filenames
Date: Thu, 25 Sep 2008 22:24:13 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

On Thu, Sep 25, 2008 at 02:25:18PM -0500, Ted Zlatanov wrote:
> On Thu, 25 Sep 2008 11:27:38 -0700 Patrick Horgan <address@hidden> wrote: 
> 
> PH> Rinehart, Raleigh wrote:
> >> You can do a mass rename with something like this in a bash shell 
> >> (untested)
> >> find . -name *.flac | while read f; do mv "$f" `echo "$f" | sed 's/
> >> /-/g'`; done
> >> 
> PH> I love Unix:)
> 
> This is a bit cleaner and probably faster, since it skips files without
> spaces in the name.  Just give it directory names as arguments.
> 
> perl -MFile::Find -e'find(sub { return unless m/\s/; $new = $_; $new 
> =~s/\s+/-/g; rename $_ => $new }, @ARGV)' DIR1 DIR2 ...
> 

or if you have zsh and the 'rename' perl utility :

% rename 's/\s+/-/g' **/*.flac




reply via email to

[Prev in Thread] Current Thread [Next in Thread]