How to unzip files that have been zipped multiple times?
I've been writing a bunch of files to a folder, however this quickly made me almost run out of space, so I decided to zip all the files. However, I messed up and did this multiple times, so some files have 4 .zips (ex *.zip.zip.zip.zip) and others have different amounts. Is there a way/terminal command to make all the files just have 1 .zip? (ex convert a file that is file.zip.zip.zip to file.zip)
Edit: Just to make things clearer, I do not want to unzip all the files, I just want them to all be compressed once.
macos command-line compression zip
add a comment |
I've been writing a bunch of files to a folder, however this quickly made me almost run out of space, so I decided to zip all the files. However, I messed up and did this multiple times, so some files have 4 .zips (ex *.zip.zip.zip.zip) and others have different amounts. Is there a way/terminal command to make all the files just have 1 .zip? (ex convert a file that is file.zip.zip.zip to file.zip)
Edit: Just to make things clearer, I do not want to unzip all the files, I just want them to all be compressed once.
macos command-line compression zip
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
@PseudoNym Hi, I'm not a bash expert but should parse the extension.zip
withawk
orsed
, count the repetitions and then un-zipn-1
given that you haven
extensions. This idea will work everytime if when you zipped a file added another trailing.zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in ashell
script. For the second I think it would be easier in another languege like python.
– dmb
Feb 8 at 14:40
add a comment |
I've been writing a bunch of files to a folder, however this quickly made me almost run out of space, so I decided to zip all the files. However, I messed up and did this multiple times, so some files have 4 .zips (ex *.zip.zip.zip.zip) and others have different amounts. Is there a way/terminal command to make all the files just have 1 .zip? (ex convert a file that is file.zip.zip.zip to file.zip)
Edit: Just to make things clearer, I do not want to unzip all the files, I just want them to all be compressed once.
macos command-line compression zip
I've been writing a bunch of files to a folder, however this quickly made me almost run out of space, so I decided to zip all the files. However, I messed up and did this multiple times, so some files have 4 .zips (ex *.zip.zip.zip.zip) and others have different amounts. Is there a way/terminal command to make all the files just have 1 .zip? (ex convert a file that is file.zip.zip.zip to file.zip)
Edit: Just to make things clearer, I do not want to unzip all the files, I just want them to all be compressed once.
macos command-line compression zip
macos command-line compression zip
edited Feb 8 at 14:29
Pseudo Nym
asked Feb 8 at 3:46
Pseudo NymPseudo Nym
62
62
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
@PseudoNym Hi, I'm not a bash expert but should parse the extension.zip
withawk
orsed
, count the repetitions and then un-zipn-1
given that you haven
extensions. This idea will work everytime if when you zipped a file added another trailing.zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in ashell
script. For the second I think it would be easier in another languege like python.
– dmb
Feb 8 at 14:40
add a comment |
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
@PseudoNym Hi, I'm not a bash expert but should parse the extension.zip
withawk
orsed
, count the repetitions and then un-zipn-1
given that you haven
extensions. This idea will work everytime if when you zipped a file added another trailing.zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in ashell
script. For the second I think it would be easier in another languege like python.
– dmb
Feb 8 at 14:40
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
@PseudoNym Hi, I'm not a bash expert but should parse the extension
.zip
with awk
or sed
, count the repetitions and then un-zip n-1
given that you have n
extensions. This idea will work everytime if when you zipped a file added another trailing .zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in a shell
script. For the second I think it would be easier in another languege like python.– dmb
Feb 8 at 14:40
@PseudoNym Hi, I'm not a bash expert but should parse the extension
.zip
with awk
or sed
, count the repetitions and then un-zip n-1
given that you have n
extensions. This idea will work everytime if when you zipped a file added another trailing .zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in a shell
script. For the second I think it would be easier in another languege like python.– dmb
Feb 8 at 14:40
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403391%2fhow-to-unzip-files-that-have-been-zipped-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1403391%2fhow-to-unzip-files-that-have-been-zipped-multiple-times%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Show the code that you ran too. Renaming files is one thing but needing to extract and then keep extracting overwriting dupes, etc. may be needed. Not sure if the code you ran would help but you might as well show what you did that caused this mess. I suppose you don't have file backups and a way to restore, right? I know that'd be too easy if that were the case. Check out my answer here though in case it helps for your immediate need; something to test with at least if nothing else: superuser.com/questions/1285257/…
– Pimp Juice IT
Feb 8 at 4:00
Ooops, it looks like you are Mac and not Windows, uh.... I'll leave comment in case it gives ideas to Mac OS experts for something Mac equivalent.
– Pimp Juice IT
Feb 8 at 4:02
I guess it might be useful to post what I ran from terminal: for item in *; do zip -m "${item}.zip" "${item}"; done. I now altered it to only convert non-zip files, but I still am left with about 1000 or so repeated zip files.
– Pseudo Nym
Feb 8 at 4:12
Utilities such as Stuffit Expander [freeware] will keep going until there's nothing left to de-compress.
– Tetsujin
Feb 8 at 8:19
@PseudoNym Hi, I'm not a bash expert but should parse the extension
.zip
withawk
orsed
, count the repetitions and then un-zipn-1
given that you haven
extensions. This idea will work everytime if when you zipped a file added another trailing.zip
extension. Other technique you could use, is to snoop inside the zip file, and if is there is another zip file decompress. The first idea could be done in ashell
script. For the second I think it would be easier in another languege like python.– dmb
Feb 8 at 14:40