Unix/Linux Go Back    


Windows & DOS: Issues & Discussions All Windows and DOS questions should go here as well. Discuss UNIX to Windows (Desktop or Server) here!

Looking for help unzip multiple file

Windows & DOS: Issues & Discussions


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by kttan
kttan's Unix or Linux Image
kttan kttan is offline
Registered User
 
Join Date: Dec 2017
Last Activity: 19 January 2018, 12:54 AM EST
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Looking for help unzip multiple file

Hi all ,

My server using backup software and backup software corrupted , unable to restore it perfectly.

so i'm need a way to 1 time unzip all file, due to now all my backup file are in zip type.

will be sometime like this :


Code:
M:\path\folder.zip
M:\path\folder\subfolder
M:\path\folder\subfolder\text.txt.zip

it is alot of folder and file, every single file been become a zip


i'm try with


Code:
unzip -jod *.zip

but unable to et it work.

Moderator's Comments:
Looking for help unzip multiple file Please use CODE tags as required by forum rules!

Last edited by RudiC; 3 Weeks Ago at 03:38 AM.. Reason: Added CODE tags.
Sponsored Links
    #2  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by kttan
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 20 January 2018, 3:19 PM EST
Location: San Jose, CA, USA
Posts: 10,927
Thanks: 609
Thanked 3,819 Times in 3,263 Posts
Quote:
Originally Posted by kttan View Post
Hi all ,

My server using backup software and backup software corrupted , unable to restore it perfectly.

so i'm need a way to 1 time unzip all file, due to now all my backup file are in zip type.

will be sometime like this :


Code:
M:\path\folder.zip
M:\path\folder\subfolder
M:\path\folder\subfolder\text.txt.zip

it is alot of folder and file, every single file been become a zip


i'm try with


Code:
unzip -jod *.zip

but unable to et it work.

Moderator's Comments:
Looking for help unzip multiple file Please use CODE tags as required by forum rules!
The command you're trying can't possibly work.

First, the unzip -d option requires an option-argument naming the directory into which files extracted from each of the files being unzipped will be placed. Your command does not provide an option-argument for the -d option.

Second, your .zip files are not all located in the same directory. Therefore, *.zip can't locate all of the .zip files on the M: drive no matter what directory you're sitting in when you invoke that command.

And, third, we have no idea what the contents are in each of your .zip files. I'm guessing that the M: drive on your Windows systems are a separate drive from the drive(s) from which the files in those .zip files were archived. Unless the .zip files contain absolute pathnames of the source files that have been archived and you want to restore those files in their original locations, we have no information on how to figure out what directory should be used as the target for the extraction of files from any of those archives. Furthermore, since you're using the unzip -j option, you're telling unzip to ignore all directory information that is stored in each archive that is being read.
Sponsored Links
    #3  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by kttan
kttan's Unix or Linux Image
kttan kttan is offline
Registered User
 
Join Date: Dec 2017
Last Activity: 19 January 2018, 12:54 AM EST
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
if so , is that any code to list all file with .zip file ?
currently my situation is all single file been zip even .exe and main folder, only sub folder are not turn into zip file.




Code:
path/main_folder.zip/sub_folder/text.txt.zip

the other method i'm using is, but i'm not sure how many zip file and sub folder are, because it include too many sub and main folder, inside folder might have another sub folder:


Code:
ls *.zip
ls */*.zip

    #4  
Old Unix and Linux 3 Weeks Ago   -   Original Discussion by kttan
rbatte1's Unix or Linux Image
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 19 January 2018, 12:39 PM EST
Location: Lancashire, UK
Posts: 3,441
Thanks: 1,493
Thanked 671 Times in 604 Posts
You might consider the find command. It will descend a directory tree trying to find matches. if you don't want it to cross into any sub-mounted filesystems or follow symbolic links then there are flags to deal with that.

As a starter for 10, try something like:-

Code:
cd /path/to/main/folder
find . -xdev -type f -name "*.zip"

What is your OS & shell? There seems to be one post using / and one using \ The output (in CODE tags) from uname -a;ps would be very useful.

If every single file has been zipped and you are confident of the unzip process, you could even extend the find to run that on each file it finds, however you have to be sure it is what you want, so copy a small part away and test it elsewhere first. Just focus on working with a single zip file first. What command do you have for unzipping one of these? Does it remove the zip file afterwards? Is that is what you want?



Kind regards,
Robin
Sponsored Links
    #5  
Old Unix and Linux 1 Week Ago   -   Original Discussion by kttan
kttan's Unix or Linux Image
kttan kttan is offline
Registered User
 
Join Date: Dec 2017
Last Activity: 19 January 2018, 12:54 AM EST
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rbatte1 View Post
You might consider the find command. It will descend a directory tree trying to find matches. if you don't want it to cross into any sub-mounted filesystems or follow symbolic links then there are flags to deal with that.

As a starter for 10, try something like:-

Code:
cd /path/to/main/folder
find . -xdev -type f -name "*.zip"

What is your OS & shell? There seems to be one post using / and one using \ The output (in CODE tags) from uname -a;ps would be very useful.

If every single file has been zipped and you are confident of the unzip process, you could even extend the find to run that on each file it finds, however you have to be sure it is what you want, so copy a small part away and test it elsewhere first. Just focus on working with a single zip file first. What command do you have for unzipping one of these? Does it remove the zip file afterwards? Is that is what you want?



Kind regards,
Robin

Thank you for help , but i'm still find how to unzip into own folder.

OS window 7 , shell kornshell

i'm using the find command , it able to list out all file, but i'm unable to make it to the unzip in the original sub folder, it extract all out at the folder i'm start.

i'm been find the unzip command with -d able to make it work , but i'm not sure how to list it.

i'm want try to make every line become like this
below are the example only


Code:
unzip -o mixed/u12/analog.zip -d mixed/u12
unzip -o digital/u12.zip -d digital

yup if possible i want to remove it , but for current state i'm need make sure everything ok only go for that step.
Sponsored Links
    #6  
Old Unix and Linux 1 Week Ago   -   Original Discussion by kttan
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 20 January 2018, 3:19 PM EST
Location: San Jose, CA, USA
Posts: 10,927
Thanks: 609
Thanked 3,819 Times in 3,263 Posts
See if this gives you a hint at a way forward:


Code:
find . -name '*.zip' | while read -r path
do	echo unzip -o "$path" -d "${path%/*}"
done

If this prints the unzip commands that you want to run, remove the echo and run it again to actually unzip the files.
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unzip the .zip file without using unzip utility in UNIX Ganesh L Shell Programming and Scripting 3 10-29-2013 05:56 AM
How to Unzip a file using unzip utility for files zipped without zip utility ? Sabari Nath S Shell Programming and Scripting 1 12-11-2009 06:18 PM
How to Unzip a .ZIP file in Unix without using unzip cmd..????? sureshg_sampat Shell Programming and Scripting 5 11-15-2008 04:44 AM
How to unzip multiple files (encrypted) in a directory. er_ashu UNIX for Dummies Questions & Answers 2 07-03-2007 06:16 PM
How to Unzip a .ZIP file in Unix without using unzip cmd..????? sureshg_sampat HP-UX 5 02-08-2007 10:01 AM



All times are GMT -4. The time now is 04:29 PM.