Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to force unzip to create a directory

Status
Not open for further replies.

eb222

MIS
Mar 12, 2007
11
NL
how do i force unzip to crate a directory

for example if i have 111.zip and do unzip -then it will unzip all files in currecnt directory

how do i force it to create a directory '111' and place the files in there
 
Perhaps create a samll script as follows:

export NEWDIR=`basename $1`
mkdir $NEWDIR
unzip -d $NEWDIR $1

then run it as <scriptname> <zipfilename>

the ` are backticks, not regular apostrophes.

HTH.

I want to be good, is that not enough?
 
Thanks very much but when i run the below command i get following error (p.s this is for solaris)

$ cat script.sh
export NEWDIR=`basename $1`
mkdir $NEWDIR
cust_unzip -d $NEWDIR $1

$ ./script.sh XXE_O2C34_QUOTE_MARGIN_1_5.zip
mkdir: Failed to make directory "XXE_O2C34_QUOTE_MARGIN_1_5.zip"; File exists
File does not exist. Please provide the complete path and zip-file.


 
NEWDIR=`basename $1 [!].zip[/!]`

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
hi

got it working thanks

forgot to do below:

export NEWDIR=`basename $1 .zip`
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top