Change the name on zip files
Hi All,
I have a question about zip file. How can I change the name of a folder after the folder is ziped, Example: I have a 'test' folder, and it includes test1.txt and test2.txt test/test1.txt test/test2.txt After I zip the folder, and then extract, it will be display test_a/test1_a.txt test_a/test2_a.txt Just change names in zip file, not in initial files. Please help me!! Thank you so much |
do you have ownership of the files? if not, the command to change ownership is:
Code:
chown username /location/file.zip Hope this helps! |
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?
|
Thanks All :)
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 ? Please help me one more! Thank you so much |
Try
Code:
zip -j test.zip test Code:
man zip |
Thank you your help, blacky_5251
I forgot to remind one thing, a1,a2,a3 are folders, not file With -j option, it cannot compress... |
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.
|
The -r option will recurse paths i.e.
Code:
zip -r test.zip test 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? |
Thanks michaelk,
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? |
The question was not directed at you.
|
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...
|
All times are GMT -5. The time now is 10:45 PM. |