I need create folder with date and add some files into that folder and need to zip that folder. For example

I have directory called A which has files like pandi_yyyymmdd.csv, vino_YYYYMMDD.csv

I need to create folder like pandi_vino_YYYYMMDD need to add above files into this folder

Finally I need to zip folder pandi_vino_YYYYMMDD

I tried like below zip -q pandi_vino.`date +%Y%m%d`pandi.20200528.csv | mkdir pandi_vino.`date +%Y%m%d

  • 2
    Are you looking for a script to run on a huge set of files or a specific solution for just these two files? Does A only contain these two files, or more? If more, which of the files need to move into the newly created directory and how can your script identify them?
    – nohillside
    May 29, 2020 at 12:33

1 Answer 1


I don't know if I understood

If you have to zip the whole A folder as pandi_vino:

FOLDER=pandi_vino_`date +%Y%m%d`; cp -r A $FOLDER && zip -r $FOLDER.zip $FOLDER

If you did mean anything else let me know, first time here

  • Is there really no zip option to provide the name of the folder and then have zip do that for you? seems like an important feature. Apr 24 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.