Bash Script to move Files

Ben Stringer ben at burbong.com
Sat Oct 8 05:07:57 UTC 2005


On Sat, 2005-10-08 at 14:48 +1000, Ben Stringer wrote:
> 
> The problem here is that find passes the files as an argument to the "rm
> -rf" command. Ie. "rm -rf file1 path/file2 file3" but in your situation,
> the mv command will be "mv /media/oggs file1 path/file2 file3" which is
> the reverse order of the arguments, to do what you want. To fix this,
> you could write a second, simple script to reverse the arguments. Eg.
> mover.sh

Better still ...

Use "mv --target-directory=/media/oggs" in your find command. The "mv"
authors have anticipated this use case.

Cheers, Ben






More information about the fedora-list mailing list