Search code examples
linuxamazon-linux

zip the files and folders inside a parent directory without including the parent directory + Amazon Linux


Is there a Linux command to zip the files and folders inside a parent directory without including the parent directory. From all the solutions that I tried, the parent directory also is getting zipped


Solution

  • Move into the folder, then zip :

    cd my-folder
    zip -r ../my-archive.zip *
    

    Dirty, but effective

    Or, in a more fancy way, using tar:

    tar czf my-archive.tar.gz -C /path/to/my-foder/ ./