Welcome to WebmasterWorld Guest from 23.20.221.93

Forum Moderators: bakedjake

Message Too Old, No Replies

How to unzip files in root?

what is the commond?

     
4:28 pm on May 24, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Aug 22, 2005
posts:324
votes: 0


Hello,

I am extracting a file called "foo.zip" using command:

unzip foo.zip

it is working fine but the problem is, it is Making a directory called "foo" and extracts all the file/subdirectories under that "foo" directory, while i want to extract all the files/directories in root.

I dont want unzip command to create a directory called "foo"

how is that possible?

Regards

9:56 pm on May 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 11, 2003
posts:5069
votes: 12


You can't do directly what you want AFAIK. The file wasn't created as a bunch of files, it was created as a bunch of files inside a directory, then the directory was zipped.

Simple fix, unzip then:
cd foo
cp * /path to root
cd ..
rm -Rf foo

(in other words, unzip to foo, go into foo, move files where you want them, then delete the foo directory)

9:57 pm on May 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 11, 2003
posts:5069
votes: 12


I say that emphatically, yet I bet there's some zip command to unzip just specific files - to do what you're asking. But it seems that the above solution (which is what I use) is easy to remember and easy to use.
11:03 pm on May 24, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 31, 2003
posts:1316
votes: 0


Just type unzip, and you'll get a help file. Mine says -j will ignore the paths and extract everything to the current directory.
6:43 am on May 25, 2007 (gmt 0)

Full Member

10+ Year Member

joined:Aug 22, 2005
posts: 324
votes: 0


cp * /path to root

This is only moving files, not folders :(

3:50 pm on May 26, 2007 (gmt 0)

Full Member

5+ Year Member

joined:Nov 26, 2006
posts:292
votes: 0


mv path /root
4:06 pm on May 28, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 11, 2003
posts:5069
votes: 12


cp -R * /path/to/move/to

that'll do it.

7:41 pm on May 28, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 31, 2003
posts:1316
votes: 0


-