cp & chown issue.

Taking care of your Linux box.
Post Reply
telenor
Havaldaar
Posts: 104
Joined: Tue Mar 29, 2005 11:08 am

cp & chown issue.

Post by telenor »

AOA,

I want to copy large amount of files aproximately more than 20,000 files from one dirctory to another, but it gives me error like:

#cd /opt/appserver/images
#cp * /opt/appserver02/public/images

Argument list is too long

Also abobe mention error appear again when i run:

#cd /opt/appserver/images
#chown root.root *

How can i copies & change owner.
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Re: cp & chown issue.

Post by lambda »

Code: Select all

rsync --inplace -PHvza /opt/appserver/images/* /opt/appserver02/public/images/
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
telenor
Havaldaar
Posts: 104
Joined: Tue Mar 29, 2005 11:08 am

Re: cp & chown issue.

Post by telenor »

AOA,

I dont want to use RSYNC, i need a script or something like commands just using xargs,find
nomankhn
Colonel
Posts: 714
Joined: Wed Aug 07, 2002 8:00 pm

Re: cp & chown issue.

Post by nomankhn »

Senior recommend rsync command, that he recommend it is fine, Why you don't want to use rsync. Do you want us to write script for you?
telenor
Havaldaar
Posts: 104
Joined: Tue Mar 29, 2005 11:08 am

Re: cp & chown issue.

Post by telenor »

AOA,

If possible to write script for me, also combination of xargs (dont rsync) required.
nomankhn
Colonel
Posts: 714
Joined: Wed Aug 07, 2002 8:00 pm

Re: cp & chown issue.

Post by nomankhn »

how much you will pay for your homework?
mfaisalkh
Havaldaar
Posts: 124
Joined: Wed Mar 17, 2004 4:05 pm
Location: Karachi

Re: cp & chown issue.

Post by mfaisalkh »

Try this:

ls -l /opt/appserver/images | xargs -i cp -rpf /opt/appserver/images/{} /opt/appserver02/public/images/
telenor
Havaldaar
Posts: 104
Joined: Tue Mar 29, 2005 11:08 am

Re: cp & chown issue.

Post by telenor »

Again i faced the same problem but now in archiving:

tar -cvf images-13122011.tar /opt/appserver02/public/images

Error is:
Argument list is too long
Post Reply