?
Solved

Uncompress File Through Cmd Shell

Posted on 2010-11-17
16
Medium Priority
?
1,112 Views
Last Modified: 2012-05-10
Hi all im using sql server 2000 and windows 2003 and i want to be able to uncompress a file using a cmd shell and wondered if anyone had the syntax to do this?
0
Comment
Question by:LBGUC04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 3
16 Comments
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34154063
When you say uncomress a file....

Do you mean the file has the compress attribue assigned to it?

Is the file compressed with a third party tool?

Is the file in a windows compressed folder?
0
 
LVL 3

Expert Comment

by:Bogeholm
ID: 34154165
Try this VBScript:


http://www.robvanderwoude.com/vbstech_files_zip.php
Be sure to go to the "UNZIP with System.Shell Folder's CopyHere method", last on the page
0
 

Author Comment

by:LBGUC04
ID: 34154175
thank you for yoru response but this must be done using a sql statement
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34154189
If you already have the command then just use

EXEC xp_cmdshell N'COMMAND'

Open in new window

0
 

Author Comment

by:LBGUC04
ID: 34155302
I have tried the following but i just get an error

exec master..xp_cmdshell 'Extract "U:\TestExtract\test.zip","U:\TestExtract"'


Extract - Verity, Inc. Version 5.0.0 (_nti40, May 13 2003)
Usage: extract [-xnv] -credentials user[:password][:domain][:mailbox] basename collname [query]
0
 
LVL 3

Expert Comment

by:Bogeholm
ID: 34155437
Hi LBGUC04

The internal command EXTRACT is not capable of extracting a ZIP-archieve!

You could use the VBScript i posted earlier. It can be executed using cscript.exe

E.g: "cscript.exe unzip.vbs"
0
 

Author Comment

by:LBGUC04
ID: 34155465
I need to find a way to do this using sql code, i can esily compress a file so there must be a way to unompress
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34155511
Does the extract command that you ran inside of the xp_cmdshell work normally?
0
 

Author Comment

by:LBGUC04
ID: 34155514
i have never used it before i got it from the link above
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34155586
Could you answer my original questions please?
0
 

Author Comment

by:LBGUC04
ID: 34155632
i did

Does the extract command that you ran inside of the xp_cmdshell work normally?

What does this mean?

If i run exec master..xp_cmdshell 'Extract'

then i get this

Extract - Verity, Inc. Version 5.0.0 (_nti40, May 13 2003)
Usage: extract [-xnv] -credentials user[:password][:domain][:mailbox] basename collname [query]

0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 34155644
Sorry i waas refering to my first post.

When you say uncomress a file....

Do you mean the file has the compress attribue assigned to it?

Is the file compressed with a third party tool?

Is the file in a windows compressed folder?
0
 

Accepted Solution

by:
LBGUC04 earned 0 total points
ID: 34162363
Dotn worry i founf out how to do it using UNZIP in cmd shell
0
 
LVL 3

Expert Comment

by:Bogeholm
ID: 34162962
Hi LBGUC04,

Please share your solution :-)
0
 

Author Comment

by:LBGUC04
ID: 34163179
--Uncompress Files
declare @sql varchar(8000)
set @sql = 'exec master..xp_cmdshell ''UNZIP -j -o U:\TestExtract\test.zip -d U:\TestExtract'''

print @sql
exec (@SQL)
0
 

Author Closing Comment

by:LBGUC04
ID: 34186511
i have the answer
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question