Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find then send result to driectory 1

Status
Not open for further replies.

nimrodman

MIS
Nov 22, 2005
43
US
I really need help with a way to copy files found with find into a directory, any help will do, thanks.
 
find (options) > filelist
for files in `cat filelist`
do
cp $file /directory-of-your-choice
done
 
Sorry,
line should read $files (plural)
cp $files /directory-of-your-choice
 
Any old find should be able to do this (no fancy GNU options needed):

[tt]find /your/source/dir -type f -exec cp {} /your/dest/dir \;[/tt]

But of course you loose the dir structure in the copy destination and you poosibly overwrite files if files with the same name exist in different subdirs of /your/source/dir ...


HTH,

p5wizard
 
Why not simply use the -cpio primitive of the find command ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi

Correct, p5wizard. My solution would have more sense only if I would continue as I started to play with it. As I renounced to copy with path to avoid overwrites, your solution is better.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top