Unzip subfolder to some path.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unzip subfolder to some path.
# 1  
Old 11-09-2009
Unzip subfolder to some path.

I have a zip file (somezipfile.zip) with the following contents in it:

dir1/subdir1/somefile1.txt
dir1/subdir2/somefile2.txt
dir1/subdir2/somefile3.txt
dir1/somefile3.txt
dir1/somefile4.txt
dir2/somefile5.txt
dir2/somefile6.txt

Lets say I unzip this to my home directory so now I have:

/home/me/dir1/subdir1/somefile1.txt
/home/me/dir1/subdir2/somefile2.txt
/home/me/dir1/subdir2/somefile3.txt
/home/me/dir1/somefile3.txt
/home/me/dir1/somefile4.txt
/home/me/dir2/somefile5.txt
/home/me/dir2/somefile6.txt

Now I do rm -rf /home/me/dir1/subdir2:
/home/me/dir1/subdir1/somefile1.txt
/home/me/dir1/somefile3.txt
/home/me/dir1/somefile4.txt
/home/me/dir2/somefile5.txt
/home/me/dir2/somefile6.txt

How can I unzip ONLY the subdir2 folder and the files it contains into the /home/me/dir1 folder without freshening or touching the other directories?

Also consider I may have subdirectories within subdir2 as well.

All responses are greatly appreciated. Thanks in advance.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unzip the .zip file without using unzip utility in UNIX

I have .zip file, i want to list all the files archived in the zip file. unzip utility is not working for me in unix. Please help me resolve this issue Thanks ganesh. (3 Replies)
Discussion started by: Ganesh L
3 Replies

2. UNIX for Dummies Questions & Answers

Unzip & Env Path Name

I need to download team foundation server on Unix (4 simple instructions below), but I am stuck.. I am newbie Unix user, so please be patient. -cd /home/Myname/Downloads, Unzip -Unzipped to /home/Myname/DestFolder -cd DestFolder, type tf -help, works there - outside this folder, doesn't... (1 Reply)
Discussion started by: software2007
1 Replies

3. Shell Programming and Scripting

Link multiple files from different subfolder to a new subfolder

Hi, I have the following subfolder with files: /data/a/1/xxx.txt /data/b/2/yyy.txt /data/c/3/zzz.txt And i have a set of new folders which have exactly the same structure as above but different disk without the files: /data_02/a/1/ /data_02/b/2/ /data_02/c/3/ Now i would like to... (6 Replies)
Discussion started by: total_ysf
6 Replies

4. Shell Programming and Scripting

How to Unzip a file using unzip utility for files zipped without zip utility ?

Hi, I need to zip/compress a data file and send to a vendor. The vendor does have only unzip utility and can accept only .ZIP files. I do not have zip utility in my server. How do I zip/compress the file so that it can be deflated using unzip command ? I tried gzip & compress commands, but... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

5. UNIX for Dummies Questions & Answers

How to Get the count fo files in each subfolder

Hi is there a command to get the count of files inside each sub directory in a directory. example: in a directory like this /opt/:> ls subdir1 subdir2 subdir3 I need to see the count of files in sub directories like this: /opt/subdir1: 3 files /opt/subdir2: 5 files /opt/subdir3: 10... (1 Reply)
Discussion started by: sanjangr
1 Replies

6. UNIX and Linux Applications

Samba read only subfolder.

Hi, I need to make a folder read only under a fileshare that has full permissions granted to it. The fileshare with full permissions is /u02/prodfileshare. The folder I need to make read only for everyone except the owner of the folder is called /u02/prodfileshare/EFT/purchases. ... (0 Replies)
Discussion started by: sparcman
0 Replies

7. Shell Programming and Scripting

unzip few files but with same path and file name.

Hi Everyone, For exmaple, i have 5 .zip files. So i can do "unzip -L -o file1.zip -d /home/user1" for every 5 files. But the problem is those 5 zip files, have same path and file name. So if i use "-o", all will be overwirte. The output is unzip all files, but put all unzipped files... (1 Reply)
Discussion started by: jimmy_y
1 Replies

8. Shell Programming and Scripting

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

9. Shell Programming and Scripting

Get zip path from unzip -l

I am listing the contents of a zip file and then grepping for a specific string ie: filename.a to get a line like: 309753 10-18-08 15:20 etc/filename.a The etc/filename.a is the path the file is at within the zip file...how might I capture this path as I want to use that path to unzip that... (2 Replies)
Discussion started by: phreezr
2 Replies

10. HP-UX

How to Unzip a .ZIP file in Unix without using unzip cmd..?????

Hi All I have ftped a .ZIP file (zipped using WinZip in Windows) to my Unix server (HP-UX). I don't have unzip cmd available in my curent Unix version Please let me know any cmd in UNIX (other than unzip) using which I can unzip this .ZIP file . Please elaborate on the commands aval and... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies
Login or Register to Ask a Question
dircmp(1)						      General Commands Manual							 dircmp(1)

NAME
dircmp - directory comparison SYNOPSIS
n] dir1 dir2 DESCRIPTION
examines dir1 and dir2 and generates various tabulated information about the contents of the directories. Sorted listings of files that are unique to each directory are generated for all the options. If no option is entered, a sorted list is output indicating whether the filenames common to both directories have the same contents. Compare the contents of files with the same name in both directories and output a list telling what must be changed in the two files to bring them into agreement. The list format is described in diff(1). Suppress messages about identical files. Change the width of the output line to n characters. The default width is 72. EXTERNAL INFLUENCES
Environment Variables LC_COLLATE determines the order in which the output is sorted. If is not specified in the environment or is set to the empty string, the value of is used as a default. If is not specified or is set to the empty string, a default of ``C'' (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to ``C'' (see environ(5)). International Code Set Support Single- and multi-byte character code sets are supported. EXAMPLES
Compare the two directories and and produce a list of changes that would make the directories identical: WARNINGS
This command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors' sys- tems. As an alternative is recommended. SEE ALSO
cmp(1), diff(1). STANDARDS CONFORMANCE
dircmp(1)