On Thu, Apr 08, 2004 at 05:06:17PM +0100, Peter Risdon wrote: > I want to redirect the output of a command to mv(1) as the source file, > and specify somehow a destination directory. Basically, I have to move > several thousand files whose names match a number of patterns to a > single directory. > > Any suggestions will be gratefully received.
There's several ways of doing this. Assuming you've got a command "listfiles" which returns the list of files you want moved from the current directory: % mv `listfiles` /destination/directory/ If the number of files to move is larger than the maximum number of command linearguments: #!/bin/sh for f in `listfiles` ; do mv $f /destination/directory/ done or you can use xargs(1): listfiles | xargs -J % mv % /destination/directory/ Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK
pgp00000.pgp
Description: PGP signature