Argument list too long when zipping large list of certain files in a folder The 2019 Stack Overflow Developer Survey Results Are InSolving “mv: Argument list too long”?How to print a range of IP addresses with Linux seq commandbash: /usr/bin/perl: Argument list too long/usr/bin/awk: Argument list too longArgument list too long with just 5000 filesAWK Using a Variable in an Equality Expressionbash array with variable in the nameReplace a long string with the sed command: Argument list too long errorAdd text to each value while looping thru and printing them in a array?Moving random files using shuf and mv - Argument list too long

Why was M87 targeted for the Event Horizon Telescope instead of Sagittarius A*?

What do hard-Brexiteers want with respect to the Irish border?

Does HR tell a hiring manager about salary negotiations?

Kerning for subscripts of sigma?

How do you keep chess fun when your opponent constantly beats you?

Cooking pasta in a water boiler

How much of the clove should I use when using big garlic heads?

How did passengers keep warm on sail ships?

A word that means fill it to the required quantity

Is one supposed to eat the zero'ah (shank bone) from the Seder plate?

I am an eight letter word. What am I?

"as much details as you can remember"

Keeping a retro style to sci-fi spaceships?

What do these terms in Caesar's Gallic wars mean?

writing variables above the numbers in tikz picture

How to support a colleague who finds meetings extremely tiring?

Why can't devices on different VLANs, but on the same subnet, communicate?

How come people say “Would of”?

Why “相同意思的词” is called “同义词” instead of "同意词"?

Falsification in Math vs Science

How do I free up internal storage if I don't have any apps downloaded?

How do PCB vias affect signal quality?

Deal with toxic manager when you can't quit

How to charge AirPods to keep battery healthy?



Argument list too long when zipping large list of certain files in a folder



The 2019 Stack Overflow Developer Survey Results Are InSolving “mv: Argument list too long”?How to print a range of IP addresses with Linux seq commandbash: /usr/bin/perl: Argument list too long/usr/bin/awk: Argument list too longArgument list too long with just 5000 filesAWK Using a Variable in an Equality Expressionbash array with variable in the nameReplace a long string with the sed command: Argument list too long errorAdd text to each value while looping thru and printing them in a array?Moving random files using shuf and mv - Argument list too long



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I'm trying to zip a certain large number of files by creating an array of them. Then I tried to run the zip command but met with "Argument list too long" error.



declare -a arr=() 

fixed=5
for i in `seq 10 1 200`; do
for j in `seq $((i+fixed)) 1 200`; do
arr+=("$i_$j.xxx")
done
done

new_arr=$(printf ",%s" "$arr[@]")
new_arr=$new_arr:1

zip all_data.zip $new_arr









share|improve this question
























  • As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

    – Henno Brandsma
    Mar 24 at 13:51


















4















I'm trying to zip a certain large number of files by creating an array of them. Then I tried to run the zip command but met with "Argument list too long" error.



declare -a arr=() 

fixed=5
for i in `seq 10 1 200`; do
for j in `seq $((i+fixed)) 1 200`; do
arr+=("$i_$j.xxx")
done
done

new_arr=$(printf ",%s" "$arr[@]")
new_arr=$new_arr:1

zip all_data.zip $new_arr









share|improve this question
























  • As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

    – Henno Brandsma
    Mar 24 at 13:51














4












4








4








I'm trying to zip a certain large number of files by creating an array of them. Then I tried to run the zip command but met with "Argument list too long" error.



declare -a arr=() 

fixed=5
for i in `seq 10 1 200`; do
for j in `seq $((i+fixed)) 1 200`; do
arr+=("$i_$j.xxx")
done
done

new_arr=$(printf ",%s" "$arr[@]")
new_arr=$new_arr:1

zip all_data.zip $new_arr









share|improve this question
















I'm trying to zip a certain large number of files by creating an array of them. Then I tried to run the zip command but met with "Argument list too long" error.



declare -a arr=() 

fixed=5
for i in `seq 10 1 200`; do
for j in `seq $((i+fixed)) 1 200`; do
arr+=("$i_$j.xxx")
done
done

new_arr=$(printf ",%s" "$arr[@]")
new_arr=$new_arr:1

zip all_data.zip $new_arr






bash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 3:59







Zack

















asked Mar 24 at 3:54









ZackZack

234




234












  • As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

    – Henno Brandsma
    Mar 24 at 13:51


















  • As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

    – Henno Brandsma
    Mar 24 at 13:51

















As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

– Henno Brandsma
Mar 24 at 13:51






As an alternative: you can create an empty zip file at the beginning and add a file to that zip file, instead of making an array first and adding them all at once. Might save you a loop, unless you have need for the array for other reasons...

– Henno Brandsma
Mar 24 at 13:51











1 Answer
1






active

oldest

votes


















6














extract from man zip ( linux version )



 zip -@ foo
will store the files listed one per line on stdin in foo.zip.


example from the same man page



 find . -name "*.[ch]" -print | zip source -@


So steps will be :



  1. build a list off all files to be archive , format must one file name by line



  2. run zip command



    cat BIG_FILENAME_LIST.txt | zip thebigziparchive -@







share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508247%2fargument-list-too-long-when-zipping-large-list-of-certain-files-in-a-folder%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    extract from man zip ( linux version )



     zip -@ foo
    will store the files listed one per line on stdin in foo.zip.


    example from the same man page



     find . -name "*.[ch]" -print | zip source -@


    So steps will be :



    1. build a list off all files to be archive , format must one file name by line



    2. run zip command



      cat BIG_FILENAME_LIST.txt | zip thebigziparchive -@







    share|improve this answer



























      6














      extract from man zip ( linux version )



       zip -@ foo
      will store the files listed one per line on stdin in foo.zip.


      example from the same man page



       find . -name "*.[ch]" -print | zip source -@


      So steps will be :



      1. build a list off all files to be archive , format must one file name by line



      2. run zip command



        cat BIG_FILENAME_LIST.txt | zip thebigziparchive -@







      share|improve this answer

























        6












        6








        6







        extract from man zip ( linux version )



         zip -@ foo
        will store the files listed one per line on stdin in foo.zip.


        example from the same man page



         find . -name "*.[ch]" -print | zip source -@


        So steps will be :



        1. build a list off all files to be archive , format must one file name by line



        2. run zip command



          cat BIG_FILENAME_LIST.txt | zip thebigziparchive -@







        share|improve this answer













        extract from man zip ( linux version )



         zip -@ foo
        will store the files listed one per line on stdin in foo.zip.


        example from the same man page



         find . -name "*.[ch]" -print | zip source -@


        So steps will be :



        1. build a list off all files to be archive , format must one file name by line



        2. run zip command



          cat BIG_FILENAME_LIST.txt | zip thebigziparchive -@








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 24 at 4:16









        EchoMike444EchoMike444

        1,0506




        1,0506



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f508247%2fargument-list-too-long-when-zipping-large-list-of-certain-files-in-a-folder%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Moe incest case Sentencing See also References Navigation menu"'Australian Josef Fritzl' fathered four children by daughter""Small town recoils in horror at 'Australian Fritzl' incest case""Victorian rape allegations echo Fritzl case - Just In (Australian Broadcasting Corporation)""Incest father jailed for 22 years""'Australian Fritzl' sentenced to 22 years in prison for abusing daughter for three decades""RSJ v The Queen"

            Do native speakers use “ultima” and “proxima” frequently in spoken English?How do native speakers say 'the light bulb has stopped working'the difference between “to revamp” ,“enhance” and “overhaul”How do we tell our currently running year of age?What's the layperson's term for words like “am”, “be”, “were”?How do I speak about a respectful person?Finger distance in musicWhat do we call English with dots and dashes?Do native speakers use 'so-so'?How to express “friends that I only know them on internet” English?Does “Until when” sound natural for native speakers?

            Who is our nearest planetary neighbor, on average?Santa Claus flies to the South PoleSeven Spheres of Unequal Mass, a weighing problem with a twistDescribe a large integerFast Mental Calculation of $7.5^7$Math in Space (without the help of celebrities)Find the value of $bigstar$: Puzzle 8 - InequalityWho drinks beer while running anyway?A Crucial DeliveryRanking And AverageHow long will my money last at roulette?