There are about 40 directories, and each must be packaged in an archive with its own name. Standard means it turns out to create only one archive containing all the directories.

You need to pack with the zip program.

I tried to write a simple bash script:

#!/bin/bash echo for folder in * # НС знаю ΠΊΠ°ΠΊ ΠΎΠ±ΠΎΠ·Π½Π°Ρ‚ΡŒ всС ΠΏΠ°ΠΏΠΊΠΈ do zip -m $file.zip $folder done echo exit 0 

    2 answers 2

     #!/bin/bash # Π—ΠΈΠΏΡƒΠ΅ΠΌ всС ΠΏΠΎΠ΄Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΠΈ for folder in * do if [ -d $folder ] then # Π­Ρ‚ΠΎ дирСктория - Π·ΠΈΠΏΡƒΠ΅ΠΌ Π΅Ρ‘ echo "Π—ΠΈΠΏΡƒΠ΅ΠΌ ΠΏΠΎΠ΄Π΄ΠΈΡ€Π΅ΠΊΡ‚ΠΎΡ€ΠΈΡŽ $folder" zip -r ${folder}.zip $folder > /dev/null fi done echo Π Π°Π±ΠΎΡ‚Π° Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½Π° 

      To bypass all the folders in the current directory allows construction

       for d in */; do; ...; done 

      Thus, the script will take the following form:

       #!/bin/bash for d in */ do echo "Zipping folder \"$d\"..." zip -m $d.zip $d done 

      Keep in mind that the script "does not see" hidden directories (whose names begin with a dot) and does not work correctly if there are no subdirectories in the current directory.


      The following script is deprived of all these shortcomings, using the find in its work:

       #!/bin/bash for d in $( find . -maxdepth 1 -type d ! -path . ) do echo "Zipping folder \"$d\"..." zip -m $d.zip $d done 

      The first script also processes symbolic links, the second one skips them. If they also need to be processed, add the -L switch to the find :

       find -L . -maxdepth 1 -type d ! -path .