Monday, April 29, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 2437  / 2 Years ago, tue, september 6, 2022, 3:26:30

I am trying to run this zip command on an Ubuntu WSL: zip -r /home/chansen/db-backup/backup.zip /mnt/c/data/db/*



I want the zip to contain all contents of db at the top level, but the resulting zip has those files nested inside all the parent directories. The zip file contains: mnt > c > data > db > myFiles. I just want the myFiles part to be at the top level without all those parent directories.


More From » command-line

 Answers
7

One way to accomplish this would be to cd into the db directory, then run your zip command using a relative path, like this:



cd /mnt/c/data/db/
zip -r /home/chansen/db-backup/backup.zip ./*

[#3291] Tuesday, September 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dersol

Total Points: 78
Total Questions: 100
Total Answers: 124

Location: Christmas Island
Member since Mon, Oct 19, 2020
4 Years ago
dersol questions
;