Web lists-archives.com

Re: Backup problem using "cp"

On 05/06/2018 09:33 AM, Thomas Schmitt wrote:

Richard Owlett wrote:
cp -ax / "/media/richard/MISC
cp: cannot stat '/media/richard/MISC
File name too long

You tell cp to copy / including its sub tree /media/richard/... which is
the target of the copy process. So as soon as reading reaches that tree
it begins to copy itself into itself endlessly until it bonks against
a filesystem limit.

You need to exclude the target directory from being copied.
E.g. by not giving "/" as copy source but rather all its files and
directories except "/media".

Thought I was doing that by specifying -x.
Any way to accomplish that without explicitly listing all directories except /media ?