I have tried this many times but not yet got it. How to use 7zip to zip directory without one directory inside other. Like:

I have a folder /home/files/ and inside that, directory1/ and directory2/.

So how to 7zip files without directory1/

One example what I had tested:

7z a -t7z /home/backups/backup /home/files -x!/directory1

Use find in conjunction with your command 7z

find /directory/to/zip -maxdepth 1 -type d ! -name "ExcludeMe" -exec 7z {} +

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.