A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
Linux / UNIX
Author
Arg list too long - while using unix shell commands.
Peter Rooke
Ranch Hand
Joined: Oct 21, 2004
Posts: 779
I like...
posted
Dec 02, 2010 07:26:50
0
Hi ranchers - just a quick Solaris shell question. I keep getting a - "arg list too long" as I'm dealing with a large volume of files. So for example:
$ tar cvf swift_processed_old.tar swift.536* ksh: /bin/tar: arg list too long
My way round this would be to use a for loop:
for file in `ls -1` do tar uvf swift_processed_old.tar $file done
But does anyone know how this can be done quicker? (thanks in advance
)
Regards Pete
Lester Burnham
Rancher
Joined: Oct 14, 2008
Posts: 1337
posted
Dec 02, 2010 09:33:07
0
Check out the
xargs
utility - it can be used to get around this problem. Not sure if it's going to be faster than using a loop, though.
Peter Rooke
Ranch Hand
Joined: Oct 21, 2004
Posts: 779
I like...
posted
Dec 03, 2010 03:17:35
0
Thanks - speeds not an issue as I'm just tar'ing and compressing to make room! Got to keep the sys admins happy
Did a quick trawl on the web and found this:
http://blog.kloppmagic.ca/archives/2004/12/21/using-xargs/
I agree. Here's the link:
http://aspose.com/file-tools
subject: Arg list too long - while using unix shell commands.
Similar Threads
Not able to install Eclipse in UNIX
Java ProcessBuilder ignoring flags
Problem in starting the Application Server in WAS4.0
how to tar files from within the java program?
How to create a pkg
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter