Re: Scripting names from a file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Sep 28, 2004, at 1:22 PM, Jeff Vian wrote:
for i in `cat file_with_names` ; do
mv $i /dest/dir
done

should do the trick for all files listed in the file.
You may wish to add a -f (force) option to the move command to avoid
nasty notes if the file does not exist or if it cannot be moved for some
reason.

If the file names have any problem characters (e.g. spaces or anything else that needs to be escaped from the shell) you could also use the following syntax:


cat file_with_names | while read line ; do
mv "$line" /dest/dir
done

This would assume the file names were listed one per line.

--
Patrick D. McSwiggen                         pat.mcswiggen@xxxxxxxxxxx
Department of Mathematics                     Office: +1 513 556-4080
University of Cincinnati                         FAX: +1 513 556-3417


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux