Howdy, Stranger!

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

Categories

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

  • XfactorXfactor Member Posts: 343
    : 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
  • ishaiishai Member Posts: 5
    : : 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.
  • Shawn CarterShawn Carter Member Posts: 0

    _______ { http://forcoder.org } free ebooks and video tutorials about ( Perl, PL/SQL, Go, PHP, C, Python, C++, Visual Basic, MATLAB, JavaScript, Objective-C, Scratch, R, C#, Ruby, Delphi, Swift, Assembly, Java, Visual Basic .NET VBScript, Bash, Lua, COBOL, Scala, Transact-SQL, Dart, F#, Hack, Ada, Rust, Lisp, Erlang, Awk, Prolog, LabVIEW, D, Fortran, FoxPro, Apex, ML, Logo, ABAP, Crystal, Clojure, Alice, Julia, Scheme, Kotlin, SAS ) ___________

Sign In or Register to comment.