Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

Argument list too long in find comand with pecified targets

SOLVED
Go to solution
Kevin Aingworth
Occasional Advisor

Argument list too long in find comand with pecified targets

How do i solve this error i keep getting when running my script for a backup dump:

/sbin/find: arg list too long

the line of script is:

find $TARGETS -print | cpio -ovC 65536 > /dev/nrmt0h

where $TARGETS are Different Folders in the directory
12 REPLIES
Steve Burt_1
Advisor

Re: Argument list too long in find comand with pecified targets

How about using xargs

find $HOME -maxdepth 2 -name '*jpg' -print0 | xargs -0 xv

--Steve
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

Would it work this way then

find -maxdepth 5 -name '$TARGETS' -print0 | xargs -0 | cpio -ovC > /dev/nrmt0h

let me know cause our apps are on this drive and backups haven't run for the last two months
Steve Burt_1
Advisor

Re: Argument list too long in find comand with pecified targets

Try

find $TARGETS -print | xargs | cpio -ovC 65536 > /dev/nrmt0h

This link is very good

http://www.grymoire.com/Unix/Find.html#uh-4
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

Nope still Doesn't work. maybe i must split the script and do a find for each directory if i don't come right
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

Is it not maybe the block size that i specify that is causing me grief

"-C 65536"
Steve Burt_1
Advisor

Re: Argument list too long in find comand with pecified targets

Hi Kevin,

You may have a point!

why not remove the blocksize

I use prefer using tar :-)

--Steve
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

well i'll try that the thing is our Unix administrator left and this script was written in 1999 so its not mine thats why i don't want to change too much when i get time i will write a new one
Steve Burt_1
Advisor

Re: Argument list too long in find comand with pecified targets

This is also a very helpful link with using tar...and backups

http://www.cyberciti.biz/faq/linux-tape-backup-with-mt-and-tar-command-howto/

--Steve
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

think i'm just going to take out that line and try this:

tar -czf /dev/nrmt0h $TARGETS

or

tar - czf /dev/nrmt0h ./directory ./directory2 .....and so on

What u think
Steve Burt_1
Advisor
Solution

Re: Argument list too long in find comand with pecified targets

That sounds a good idea directory by directory to get you going...

If its a large amount of data you may have to use the multiple tape option... as descibed in that second link...

--Steve
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

Thanks a million for the help Steve you'll see I've given you relevant points for your help. although i'm not going to go with the tar command anymore as the problem is the Guys doing the backup and restores are not familiar on how to restore with the tar command. so I've decided to split up my targets in section and just append on the tape (>>).

Regards
Kevin

see you around the forum
Kevin Aingworth
Occasional Advisor

Re: Argument list too long in find comand with pecified targets

Read above for solution