Re removing hyphens from filenames

Abigail abigail at abigail.be
Thu Jul 12 12:53:10 BST 2007


On Thu, Jul 12, 2007 at 12:34:55PM +0100, Peter Corlett wrote:
> 
> "Removing hyphens from filenames" is a different problem from "removing
> files whose name starts with a hyphen".
> 
> find . | sort -r | perl -ne 'chomp; $a=$_; s/-//g; rename $a, $_ or die "Rename $a to $_ failed: $!"'
> 
> would probably do it. There's probably some clever Unix filter I've
> forgotten that would have saved me breaking out the Perl.


for f in `find . -name '*-*'`; do mv $f `echo $f | tr -d -`; done


Abigail


More information about the london.pm mailing list