[Gllug] cp real files but not links
Hari Sekhon
hpsekhon at googlemail.com
Wed Feb 25 15:28:10 UTC 2009
David Damerell wrote:
> On Wednesday, 25 Feb 2009, David L Neil Mailing list a/c wrote:
>
>> Is it possible to copy a directory's contents (and sub-directories) to a
>> new location, but only the 'real files' and not any symlinks?
>>
>
> You could do a "find -type l" after the copy. Remember to do something
> like "find -print0 ... |xargs -0" to avoid tripping up on baroque
> filenames.
>
>
Or do a "find -type f" piped through a bash loop to test if it's a link
and cp it only if not...
might be better if what you are doing is sensitive to what is put there
and you want to avoid a race condition between copying everything and
deleting links later...
-h
--
Hari Sekhon
Always open to interesting opportunities
http://www.linkedin.com/in/harisekhon
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list