newbie question - how to pass textfile as an argument
Hi, I was just wondering if there is a way how to pass a text file with list of path/files to programs like cp/mv. Thanx Martin ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newbie question - how to pass textfile as an argument
In the last episode (Oct 01), Martin Vana said: I was just wondering if there is a way how to pass a text file with list of path/files to programs like cp/mv. If the list is small (less than 65000 characters total): cp $(cat myfile) /otherdir/ If the list is large: xargs myfile -J% cp % /otherdir/ -- Dan Nelson [EMAIL PROTECTED] ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newbie question - how to pass textfile as an argument
-BEGIN PGP SIGNED MESSAGE- ~ On 01-Oct-2003, Martin Vana wrote message newbie question - how to pass textfile as an argument ~ I was just wondering if there is a way how to pass a text file with list of path/files to programs like cp/mv. AFAIK, you can't. You can, however, use something like the find command. find /somedir -type f -name '*pattern*' -maxdepth 1 -exec mv {} newdir \; (maxdepth 1 limits it to the current directory, otherwise it is recursive.) ~~ Andy Harrison (full headers for details) -BEGIN PGP SIGNATURE- Version: PGP 6.5.8 iQCVAwUBP3s6GVPEkLgodAWVAQHWhAQAij/sg4mNSJzdHn0ISnHF3tgdd7FVgbe0 lIHbNBZn6jFrhrd8QXSv22cHKftN/1kDsoAywB7bLVeXHgzKKek/NuWt98qE3/Rp osVwgGOj8S2c/sBm8tPjHlkcxAdQxM7MlNcMc29sDlQ+smdKYCIjKn0Nv1jPqzeP W3PmyqXefOE= =wuMG -END PGP SIGNATURE- ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: newbie question - how to pass textfile as an argument
On Wed, 1 Oct 2003, Dan Nelson wrote: In the last episode (Oct 01), Martin Vana said: I was just wondering if there is a way how to pass a text file with list of path/files to programs like cp/mv. If the list is small (less than 65000 characters total): cp $(cat myfile) /otherdir/ If the list is large: xargs myfile -J% cp % /otherdir/ You could also run it through a for loop: for i in $(cat myfile); do mv $i ~/mydir; done Or if the files can be grouped by a pattern: for i in *.mp3; do mv $i ~/mymp3s; done Or if the files are scattered all over your hard drive and you haven't created a list yet: find / -type f -name *.mp3 -exec mv {} ~/mymp3s \; Cheers, Viktor ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]