The rename
command in Ubuntu 12.04 (manpage says it's part of perl v5.14.2 2012-03-23) works well in a single directory, but I want to use it on subdirectories too (or, more generally, on a list of files that is the output of another command, via backquotes). For example, I'd expect
rename "s/ /-/g" `find .`
to change all spaces to dashes in all filenames below the current dir. But this command does nothing.
(Edit: changed rename -n
to rename
. That option's good for safely experimenting, but only a distraction here.)
The backquotes are not at fault, because replacing find .
with e.g. echo */*
works.
First doing find . > foo
, and then replacing find .
with cat foo
, does nothing.
Even collapsing the list of files into one line, by replacing find .
with find . | tr -d '\n'
, does nothing.
Which element is at fault?