2012-04-11 16:56:20 -0400, Greg Wooledge:
[...]
> find . -type f ! -name '*.*' \
> -exec sh -c 'for f; do mv "$f" "$f.txt"; done' _ {} +
>
> (assuming you wanted to add .txt)
It calls one mv per file which is going to take a long time for
millions of files.
Alternative is to use a shell with a builtin mv like zsh (which
also has a zmv helper function for this kind of task), or use a
dedicated tool like mmv as already suggested, or use perl or any
programming language that can do the renaming without spawning a
new command:
find . -type f ! -name '*.*' -exec perl -e '
for $f (@ARGV) {rename "$f", "$f.txt" or warn "rename $f: $!"}' {} +
Beware that perl's rename() clobbers any existing file (that is,
if there's both a file "foo" and "foo.txt", you'll lose the
original "foo.txt").
--
Stephane