Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Unzip subfolder to some path. Post 302369708 by mrwatkin on Monday 9th of November 2009 10:19:17 AM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
SYNCTREE(1)						      General Commands Manual						       SYNCTREE(1)

NAME
synctree - synchronize directory trees. SYNOPSIS
synctree [-iuf] [[user1@]machine1:]dir1 [[user2@]machine2:]dir2 DESCRIPTION
Synctree synchronizes the directory tree rooted at dir2 with dir1. It walks recursively through both trees, and deletes and adds files in dir2 to make it equal to dir1. Mode, owner and group are set for each file unless the -u flag is given. In its normal mode of operation, synctree will ask if it may delete or add directories assuming that you don't want to. Non-directories are simply deleted or added, but synctree will ask if it needs to update a normal file with a default answer of 'y'. Simply typing return will choose the default answer, typing end-of-file is like typing return to this question and all other questions. You can specify a hostname and user-id to be used to access dir1 or dir2. Synctree will use rsh(1) to run a copy of itself on the remote machine. The call interface mimics that of rcp(1), but you can use more than one user@machine prefix if you want to make things really interesting. Hard links are enforced, an update is done by first deleting the old file so that links to unknown files are broken. Links to files within dir2 will be restored. If either directory contains the file .backup, then this file will be used as an alternate inode table. This allows one to make a backup copy of a file tree full of special files and differing user-ids on a remote machine under an unpriviledged user-id. OPTIONS
-i Ask for permission (with default answer 'n') to delete or add any file or directory. -u Only install newer files, i.e. merge the directory trees. -f Don't ask, think 'yes' on any question. SEE ALSO
remsync(1), cpdir(1), rsh(1), rcp(1), perror(3). DIAGNOSTICS
Messages may come from three different processes. One named "Slave" running in dir1, one named "Master" running in dir2, and synctree itself in a mediator role. The mediator will also perform the task of either the master or the slave if one of them is running locally. You need to know this to interpret the error messages coming from one of these processes. The messages are normally based on perror(3). Failure to contact a remote machine will be reported by rsh. Synctree should have a zero exit status if no errors have been encountered. BUGS
Directory dir2 will be created without asking. The master and slave processes get their error output mixed up sometimes (nice puzzle). The local and remote machine must use the same file type encoding. The link replacement strategy may lead to lack of space on a small device. Let synctree run to completion and then rerun it to pick up the pieces. Letting the local process keep its "synctree" name may be a mistake. It talks too much. AUTHOR
Kees J. Bot, (kjb@cs.vu.nl) SYNCTREE(1)
All times are GMT -4. The time now is 09:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy