Unzip file contents, but without creating archive folder
Clash Royale CLAN TAG#URR8PPP
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called "myarchive" with the contents of the zip file. I do not want the system to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible?
What I've been doing now is simply issuing a "cp" command to copy the files from the newly created directory (in this case "myarchive" to "b") to where I want them.
cp zip
add a comment |
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called "myarchive" with the contents of the zip file. I do not want the system to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible?
What I've been doing now is simply issuing a "cp" command to copy the files from the newly created directory (in this case "myarchive" to "b") to where I want them.
cp zip
8
By default,unzip
doesn't create a directory. Your zip file probably has the directory at its top level.
– Chris Down
Apr 18 '13 at 3:29
3
You could usemv
instead ofcp
.mv archive/* .; rmdir archive/
or similar.
– frostschutz
Apr 18 '13 at 3:35
add a comment |
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called "myarchive" with the contents of the zip file. I do not want the system to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible?
What I've been doing now is simply issuing a "cp" command to copy the files from the newly created directory (in this case "myarchive" to "b") to where I want them.
cp zip
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called "myarchive" with the contents of the zip file. I do not want the system to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible?
What I've been doing now is simply issuing a "cp" command to copy the files from the newly created directory (in this case "myarchive" to "b") to where I want them.
cp zip
cp zip
edited Jun 12 '13 at 11:06
Anthon
60.9k17103166
60.9k17103166
asked Apr 18 '13 at 2:09
ScoobaSteveScoobaSteve
161124
161124
8
By default,unzip
doesn't create a directory. Your zip file probably has the directory at its top level.
– Chris Down
Apr 18 '13 at 3:29
3
You could usemv
instead ofcp
.mv archive/* .; rmdir archive/
or similar.
– frostschutz
Apr 18 '13 at 3:35
add a comment |
8
By default,unzip
doesn't create a directory. Your zip file probably has the directory at its top level.
– Chris Down
Apr 18 '13 at 3:29
3
You could usemv
instead ofcp
.mv archive/* .; rmdir archive/
or similar.
– frostschutz
Apr 18 '13 at 3:35
8
8
By default,
unzip
doesn't create a directory. Your zip file probably has the directory at its top level.– Chris Down
Apr 18 '13 at 3:29
By default,
unzip
doesn't create a directory. Your zip file probably has the directory at its top level.– Chris Down
Apr 18 '13 at 3:29
3
3
You could use
mv
instead of cp
. mv archive/* .; rmdir archive/
or similar.– frostschutz
Apr 18 '13 at 3:35
You could use
mv
instead of cp
. mv archive/* .; rmdir archive/
or similar.– frostschutz
Apr 18 '13 at 3:35
add a comment |
4 Answers
4
active
oldest
votes
My version of unzip
has a -j
option to not create any directory.
So
unzip -j /path/to/file.zip
Will extract all the files into the current directory without restoring the directory structure stored in the zip
file.
If you want to only remove one level of directories from the archive, (extract myarchive/dir/file
as dir/file
, not file
), you could use bsdtar
(which does supports zip
files in addition to tar
files) instead and its -s
option.
bsdtar -xf /path/to/file.zip -s'|[^/]*/||'
7
When using-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would havezip/A/f1
,zip/A/B/f2
andzip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.
– Cristian Vrabie
Feb 4 '16 at 16:01
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
add a comment |
Looks like this is really simple with bsdtar :
bsdtar --strip-components=1 -xvf file.zip
add a comment |
If performing unzip myarchive.zip
produces a directory myarchive
with everything in it, then that means the creator of the zip file actually performed zip on that directory.
The only way to create what you want is to just move all the contents outside the directory after you perform unzip
:
[user@host]:some/path/b$ unzip myarchive.zip
[user@host]:some/path/b$ ls
shows directory myarchive
[user@host]:some/path/b$ mv myarchive/* .
[user@host]:some/path/b$ rm -R myarchive
[user@host]:some/path/b$ ls
shows first level of myarchive (directly in b
)
1
you also need amv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.
– Kinjal Dixit
Sep 5 '17 at 6:34
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you userm -R
and because you're not usingls -a
you're not showing if there are any dot files; now what happens when you runrm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?
– Pryftan
May 9 '18 at 20:22
Otohrmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.
– Pryftan
May 9 '18 at 20:23
add a comment |
What the accepted answer doesn't specify how to do, as you say in the question, if you still want to extract to a specific folder without using the folders paths stored in the zip files, you can use the -j
option with -d
option in this way:
unzip -j /path/to/file.zip -d other_folder
or for your case
unzip -j myarchive.zip -d b
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2funix.stackexchange.com%2fquestions%2f72838%2funzip-file-contents-but-without-creating-archive-folder%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
My version of unzip
has a -j
option to not create any directory.
So
unzip -j /path/to/file.zip
Will extract all the files into the current directory without restoring the directory structure stored in the zip
file.
If you want to only remove one level of directories from the archive, (extract myarchive/dir/file
as dir/file
, not file
), you could use bsdtar
(which does supports zip
files in addition to tar
files) instead and its -s
option.
bsdtar -xf /path/to/file.zip -s'|[^/]*/||'
7
When using-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would havezip/A/f1
,zip/A/B/f2
andzip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.
– Cristian Vrabie
Feb 4 '16 at 16:01
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
add a comment |
My version of unzip
has a -j
option to not create any directory.
So
unzip -j /path/to/file.zip
Will extract all the files into the current directory without restoring the directory structure stored in the zip
file.
If you want to only remove one level of directories from the archive, (extract myarchive/dir/file
as dir/file
, not file
), you could use bsdtar
(which does supports zip
files in addition to tar
files) instead and its -s
option.
bsdtar -xf /path/to/file.zip -s'|[^/]*/||'
7
When using-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would havezip/A/f1
,zip/A/B/f2
andzip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.
– Cristian Vrabie
Feb 4 '16 at 16:01
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
add a comment |
My version of unzip
has a -j
option to not create any directory.
So
unzip -j /path/to/file.zip
Will extract all the files into the current directory without restoring the directory structure stored in the zip
file.
If you want to only remove one level of directories from the archive, (extract myarchive/dir/file
as dir/file
, not file
), you could use bsdtar
(which does supports zip
files in addition to tar
files) instead and its -s
option.
bsdtar -xf /path/to/file.zip -s'|[^/]*/||'
My version of unzip
has a -j
option to not create any directory.
So
unzip -j /path/to/file.zip
Will extract all the files into the current directory without restoring the directory structure stored in the zip
file.
If you want to only remove one level of directories from the archive, (extract myarchive/dir/file
as dir/file
, not file
), you could use bsdtar
(which does supports zip
files in addition to tar
files) instead and its -s
option.
bsdtar -xf /path/to/file.zip -s'|[^/]*/||'
edited Feb 4 '16 at 16:37
answered Apr 18 '13 at 10:29
Stéphane ChazelasStéphane Chazelas
306k57580935
306k57580935
7
When using-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would havezip/A/f1
,zip/A/B/f2
andzip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.
– Cristian Vrabie
Feb 4 '16 at 16:01
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
add a comment |
7
When using-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would havezip/A/f1
,zip/A/B/f2
andzip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.
– Cristian Vrabie
Feb 4 '16 at 16:01
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
7
7
When using
-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would have zip/A/f1
, zip/A/B/f2
and zip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.– Cristian Vrabie
Feb 4 '16 at 16:01
When using
-j
the archive directory structure is not recreated and all files are deposited in the extraction folder. This means ALL subfolders are dropped. So if you would have zip/A/f1
, zip/A/B/f2
and zip/A/B/C/f3
you would end up with a single folder with f1, f2, f3. It gets funky if you have files with the same name in different subfolders. Usually you want to just drop the top folder not the entire directory structure.– Cristian Vrabie
Feb 4 '16 at 16:01
3
3
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
@CristianVrabie, well that's exactly what I'm saying in the answer. I've added a bsdtar alternative for what you're asking. See edit.
– Stéphane Chazelas
Feb 4 '16 at 16:38
add a comment |
Looks like this is really simple with bsdtar :
bsdtar --strip-components=1 -xvf file.zip
add a comment |
Looks like this is really simple with bsdtar :
bsdtar --strip-components=1 -xvf file.zip
add a comment |
Looks like this is really simple with bsdtar :
bsdtar --strip-components=1 -xvf file.zip
Looks like this is really simple with bsdtar :
bsdtar --strip-components=1 -xvf file.zip
answered Jan 31 at 10:38
ismailismail
27026
27026
add a comment |
add a comment |
If performing unzip myarchive.zip
produces a directory myarchive
with everything in it, then that means the creator of the zip file actually performed zip on that directory.
The only way to create what you want is to just move all the contents outside the directory after you perform unzip
:
[user@host]:some/path/b$ unzip myarchive.zip
[user@host]:some/path/b$ ls
shows directory myarchive
[user@host]:some/path/b$ mv myarchive/* .
[user@host]:some/path/b$ rm -R myarchive
[user@host]:some/path/b$ ls
shows first level of myarchive (directly in b
)
1
you also need amv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.
– Kinjal Dixit
Sep 5 '17 at 6:34
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you userm -R
and because you're not usingls -a
you're not showing if there are any dot files; now what happens when you runrm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?
– Pryftan
May 9 '18 at 20:22
Otohrmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.
– Pryftan
May 9 '18 at 20:23
add a comment |
If performing unzip myarchive.zip
produces a directory myarchive
with everything in it, then that means the creator of the zip file actually performed zip on that directory.
The only way to create what you want is to just move all the contents outside the directory after you perform unzip
:
[user@host]:some/path/b$ unzip myarchive.zip
[user@host]:some/path/b$ ls
shows directory myarchive
[user@host]:some/path/b$ mv myarchive/* .
[user@host]:some/path/b$ rm -R myarchive
[user@host]:some/path/b$ ls
shows first level of myarchive (directly in b
)
1
you also need amv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.
– Kinjal Dixit
Sep 5 '17 at 6:34
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you userm -R
and because you're not usingls -a
you're not showing if there are any dot files; now what happens when you runrm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?
– Pryftan
May 9 '18 at 20:22
Otohrmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.
– Pryftan
May 9 '18 at 20:23
add a comment |
If performing unzip myarchive.zip
produces a directory myarchive
with everything in it, then that means the creator of the zip file actually performed zip on that directory.
The only way to create what you want is to just move all the contents outside the directory after you perform unzip
:
[user@host]:some/path/b$ unzip myarchive.zip
[user@host]:some/path/b$ ls
shows directory myarchive
[user@host]:some/path/b$ mv myarchive/* .
[user@host]:some/path/b$ rm -R myarchive
[user@host]:some/path/b$ ls
shows first level of myarchive (directly in b
)
If performing unzip myarchive.zip
produces a directory myarchive
with everything in it, then that means the creator of the zip file actually performed zip on that directory.
The only way to create what you want is to just move all the contents outside the directory after you perform unzip
:
[user@host]:some/path/b$ unzip myarchive.zip
[user@host]:some/path/b$ ls
shows directory myarchive
[user@host]:some/path/b$ mv myarchive/* .
[user@host]:some/path/b$ rm -R myarchive
[user@host]:some/path/b$ ls
shows first level of myarchive (directly in b
)
answered Jul 19 '17 at 17:53
toinetoinetoinetoine
1011
1011
1
you also need amv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.
– Kinjal Dixit
Sep 5 '17 at 6:34
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you userm -R
and because you're not usingls -a
you're not showing if there are any dot files; now what happens when you runrm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?
– Pryftan
May 9 '18 at 20:22
Otohrmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.
– Pryftan
May 9 '18 at 20:23
add a comment |
1
you also need amv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.
– Kinjal Dixit
Sep 5 '17 at 6:34
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you userm -R
and because you're not usingls -a
you're not showing if there are any dot files; now what happens when you runrm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?
– Pryftan
May 9 '18 at 20:22
Otohrmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.
– Pryftan
May 9 '18 at 20:23
1
1
you also need a
mv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.– Kinjal Dixit
Sep 5 '17 at 6:34
you also need a
mv myarchive/.* .
to move all the hidden files like .gitignore and .htaccess.– Kinjal Dixit
Sep 5 '17 at 6:34
1
1
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you use
rm -R
and because you're not using ls -a
you're not showing if there are any dot files; now what happens when you run rm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?– Pryftan
May 9 '18 at 20:22
@KinjalDixit That was my thinking too; Antoine there's a fatal flaw in your example as Kinjai points out: because you use
rm -R
and because you're not using ls -a
you're not showing if there are any dot files; now what happens when you run rm -R
and there are dot files? You've not copied them so they're lost. You really should fix that and maybe explain the difference because it's something that will trip up newbies quite a lot; and consider this: what if it's not an archive they have? Or what if they add to the command to delete the archive once it's uncompressed?– Pryftan
May 9 '18 at 20:22
Otoh
rmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.– Pryftan
May 9 '18 at 20:23
Otoh
rmdir
would make sure it's empty first... But if the user doesn't know about dot files it'd confuse them.– Pryftan
May 9 '18 at 20:23
add a comment |
What the accepted answer doesn't specify how to do, as you say in the question, if you still want to extract to a specific folder without using the folders paths stored in the zip files, you can use the -j
option with -d
option in this way:
unzip -j /path/to/file.zip -d other_folder
or for your case
unzip -j myarchive.zip -d b
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
add a comment |
What the accepted answer doesn't specify how to do, as you say in the question, if you still want to extract to a specific folder without using the folders paths stored in the zip files, you can use the -j
option with -d
option in this way:
unzip -j /path/to/file.zip -d other_folder
or for your case
unzip -j myarchive.zip -d b
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
add a comment |
What the accepted answer doesn't specify how to do, as you say in the question, if you still want to extract to a specific folder without using the folders paths stored in the zip files, you can use the -j
option with -d
option in this way:
unzip -j /path/to/file.zip -d other_folder
or for your case
unzip -j myarchive.zip -d b
What the accepted answer doesn't specify how to do, as you say in the question, if you still want to extract to a specific folder without using the folders paths stored in the zip files, you can use the -j
option with -d
option in this way:
unzip -j /path/to/file.zip -d other_folder
or for your case
unzip -j myarchive.zip -d b
answered Mar 19 '18 at 21:57
Eduard FlorinescuEduard Florinescu
3,384103855
3,384103855
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
add a comment |
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
You're right that you can do that; but it won't create the subdirectories so you still have to incorporate another step; I'm pretty sure the OP wants to rename the root directory of the archive to another name but keep the remaining structure under that directory.
– Pryftan
May 9 '18 at 20:34
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- 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%2funix.stackexchange.com%2fquestions%2f72838%2funzip-file-contents-but-without-creating-archive-folder%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
8
By default,
unzip
doesn't create a directory. Your zip file probably has the directory at its top level.– Chris Down
Apr 18 '13 at 3:29
3
You could use
mv
instead ofcp
.mv archive/* .; rmdir archive/
or similar.– frostschutz
Apr 18 '13 at 3:35