Search code examples
bashcygwinphp-ziparchive

Add files to zip archive preservinf directory structure


I want to add a list of files (a text file contains the list of these files i.e. full windows path of each file) , i want to use cygnus win to add files to a zip archive while preserving the directory structure


Solution

  • Did you try something like this?

    tar cvf yourarchive.tar --files-from /dev/null
    for file in $(cat YOURLIST); do tar rf yourarchive.tar $file; done
    gzip yourarchive.tar
    

    The loop would append all files found in the textfile to your tarfile.