General

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 12
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