Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
That seems like odd behavior. What commands are you using to zip/unzip the files? Are you unzipping the files in a directory that already has the files in question?
I cannot solve this problem...
I'm having another solution, and wannna ask everyone.
Now, I have directory structure as below
test/test1/a1
test/test2/a2
test/test3/a3
# zip test.zip test -> when I unzip test.zip , it shows test1,test2,test3
How to I can zip 'test' directory to test.zip, and when I upzip it, it will show a1/a2/a3 ?
The only solution I can think of is to write a script that parses the directory tree to the a1/a2/a3 level and adds each directory to the zip file separately.
All files and subdirectories in test will be included in the zip file.
From your first post it appears that you are extracting the files in the same directory as they were zipped and the extracted files are being renamed. Is there an option that will rename files as posted?
Option '-r' is not effect in this case
I just want to change the path of the output zipped file
Ex: test/test1/a1(initial folder) to test/a1(in test.zip)
I don't understand your question. Can you explain more about this?
AFAIK, you can't change the content of a zip file. If you want a different output path, you'll have to create it before you zip it. Same goes for tar, gzip etc...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.