Re: recursive mv return invalid argument
From: rakesh sharma (sharma__r_at_hotmail.com)
Date: 07/03/03
- Next message: Jim Campbell: "Re: display off files as they change"
- Previous message: Peteris Krumins: "Re: How does autocomplete work?"
- In reply to: Ben Thomas: "recursive mv return invalid argument"
- Next in thread: Michael Wang: "Re: recursive mv return invalid argument"
- Reply: Michael Wang: "Re: recursive mv return invalid argument"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 2 Jul 2003 18:26:44 -0700
"Ben Thomas" <bthomas@trey-industries.com> wrote in message news:<pan.2003.07.02.19.55.30.274063@trey-industries.com>...
> this simple script :
>
> for fff in 'find ./ -type f -name *.txt'; do
> mv $fff $fff.bak
> done
>
> returns:
> mv: invalid option -- t
> Try `mv --help' for more information.
to see what's going on with u'r case, just prepend an echo
before 'mv' and see what happens:
echo mv $fff $fff.bak
to fix it,
replace the single quotes ' by backquotes `
& protect the *.txt by single quotes in order
to pass them along to the find command unexpanded.
or better still, do away with the backquotes as in:
find . -type f -name '*.txt' -exec sh -c 'mv "$1" "$1.bak"' {} {} \;
and if you have the GNU version of find, then the above can be shortened to:
find . -type f -name '*.txt' -exec mv {} {}.bak \;
- Next message: Jim Campbell: "Re: display off files as they change"
- Previous message: Peteris Krumins: "Re: How does autocomplete work?"
- In reply to: Ben Thomas: "recursive mv return invalid argument"
- Next in thread: Michael Wang: "Re: recursive mv return invalid argument"
- Reply: Michael Wang: "Re: recursive mv return invalid argument"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|