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!

cp command

Status
Not open for further replies.

keak

Programmer
Sep 12, 2005
247
CA
hi there,
I am writing a shell script and I was wondering if I can prevent contents in softlinks to be copied over with the cp -r command?

Also, is there a way in cp to copy all fiels except for a single file or directory ?

Thanks!
 
In the Korn shell, if you want to copy all files except (for example) files ending with ".txt", do this...
Code:
cp !(*.txt) /destination/dir
That "[tt]!(*.txt)[/tt]" will expand to everything BUT files ending in ".txt".
 
Try

cp -h -r src dest

to recreate softlinks instead of copying the files that the softlinks point to...


HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top