Solved

Uncompress File Through Cmd Shell

Posted on 2010-11-17
16
1,087 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
  • 8
  • 5
  • 3
16 Comments
 
LVL 16

Expert Comment

by:EvilPostIt
Comment Utility
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
Comment Utility
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
Comment Utility
thank you for yoru response but this must be done using a sql statement
0
 
LVL 16

Expert Comment

by:EvilPostIt
Comment Utility
If you already have the command then just use

EXEC xp_cmdshell N'COMMAND'

Open in new window

0
 

Author Comment

by:LBGUC04
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Does the extract command that you ran inside of the xp_cmdshell work normally?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

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

Expert Comment

by:EvilPostIt
Comment Utility
Could you answer my original questions please?
0
 

Author Comment

by:LBGUC04
Comment Utility
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
Comment Utility
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
Comment Utility
Dotn worry i founf out how to do it using UNZIP in cmd shell
0
 
LVL 3

Expert Comment

by:Bogeholm
Comment Utility
Hi LBGUC04,

Please share your solution :-)
0
 

Author Comment

by:LBGUC04
Comment Utility
--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
Comment Utility
i have the answer
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now