max. number of arguments for a "tar" command?????

Evening Guys,

I've run a "find . -type f -mtime +480" command and it gave me more
than a 100,000 files as the result. Now I've gotta pass these files
to a "tar" command and archive 'em all.......but the command

tar cvf abc.tar `find . -type f -mtime +480` says

/usr/bin/tar: argument list too long

and quits to the command prompt again. Any way out of this trouble???

Any ways to archive all the 100,000+ files at once WITHOUT writing a
dumb "for" loop in a shell script????????? PLEASE I NEED THIS INFORMATION FAST.............

Cheers.

Comments

  • : Evening Guys,
    :
    : I've run a "find . -type f -mtime +480" command and it gave me more
    : than a 100,000 files as the result. Now I've gotta pass these files
    : to a "tar" command and archive 'em all.......but the command
    :
    : tar cvf abc.tar `find . -type f -mtime +480` says
    :
    : /usr/bin/tar: argument list too long
    :
    : and quits to the command prompt again. Any way out of this trouble???
    :
    : Any ways to archive all the 100,000+ files at once WITHOUT writing a
    : dumb "for" loop in a shell script????????? PLEASE I NEED THIS INFORMATION FAST.............
    :
    : Cheers.
    :
    You need to pipe the list from your find command to the tar command.
    Something like this:
    `find . -type f -mtime +480` | tar cvf abc.tar

    If this don't work, then it's pretty close.
    X
  • : : Evening Guys,
    : :
    : : I've run a "find . -type f -mtime +480" command and it gave me more
    : : than a 100,000 files as the result. Now I've gotta pass these files
    : : to a "tar" command and archive 'em all.......but the command
    : :
    : : tar cvf abc.tar `find . -type f -mtime +480` says
    : :
    : : /usr/bin/tar: argument list too long
    : :
    : : and quits to the command prompt again. Any way out of this trouble???
    : :
    : : Any ways to archive all the 100,000+ files at once WITHOUT writing a
    : : dumb "for" loop in a shell script????????? PLEASE I NEED THIS INFORMATION FAST.............
    : :
    : : Cheers.
    : :
    : You need to pipe the list from your find command to the tar command.
    : Something like this:
    : `find . -type f -mtime +480` | tar cvf abc.tar
    :
    : If this don't work, then it's pretty close.
    : X
    :
    U can use xargs
    find .... | xargs tar ...

    Good luck.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories