SLUG Mailing List Archives
Re: [SLUG] cp command - Argument list too long
- To: Bernhard Lüder <bl@xxxxxxxxxxx>, "SLUG user group" <slug@xxxxxxxxxxx>
- Subject: Re: [SLUG] cp command - Argument list too long
- From: "Ian Ward" <ian@xxxxxxxxxxxxxxx>
- Date: Sun Feb 25 18:32:01 2001
----- Original Message -----
From: "Bernhard Lüder" <bl@xxxxxxxxxxx>
To: "SLUG user group" <slug@xxxxxxxxxxx>
Sent: Sunday, February 25, 2001 12:23 PM
Subject: [SLUG] cp command - Argument list too long
> What is the solution for this?
> I am trying to copy files and directories from on place to another for
> backup purposes I use the following command. Lately the source directory
> become rather large, which probably is the reason.
> cp -puRvf ./* /backup
> And I am getting this response:
> bash: /bin/cp: Argument list too long
The more traditional way to do this is....
find . -print -depth | cpio -pdumv /backup
You probably are doing a "rm -r" of the target beforehand otherwise you will
be accumalating files that have been deleted in the original directory.
I hate having a "rm -r" in any script, if you get it wrong you can kiss some
important stuff goodbye :)
However, in the interests of efficiency (ie not flogging your system to
death) try rsync.
rsync -av --delete . /backup
This will perform a proper sync with correct permissions. Plus it only
copies the bits that it needs to.
rsync will go across networks as well. pretty nifty. rsync comes from the
samba guys, most distros should have it.