Moving Files (Again)
Bob Bell
bobbell at zk3.dec.com
Tue Jan 7 11:38:15 EST 2003
On Tue, Jan 07, 2003 at 10:19:09AM -0500, Kevin D. Clark <kclark at cetaceannetworks.com> wrote:
> Assuming that none of the filenames contain embedded newlines or other
> strange characters:
>
> for A in `find ~/mamedk/roms2.mame.dk -name \*.zip -print | grep 'cur/[^/]*\.zip$'` ; do
> cp "$A" ~/mamedk/roms
> done
I forget if you are one of the ones who considers spaces "stange
characters", but that general method breaks with filenames with spaces.
I general find that instead of:
for foo in `find blah`; do
# do stuff
done
the following is typically more reliable:
find blah | while read foo; do
# do stuff
done
--
Bob Bell <bobbell at zk3.dec.com>
-------------------------------------------------------------------------
"Parentheses in Perl are like shoes in the Caribbean."
-- Larry Wall, creator of the Perl programming language
More information about the gnhlug-discuss
mailing list