Solved

Uncompress File Through Cmd Shell

Posted on 2010-11-17
16
1,095 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql server concatenate fields 10 35
Sql server function help 15 30
Query group by data in SQL Server - cursor? 3 34
SQL Select to Group and Filter Data 5 12
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

777 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