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
Solved

Uncompress File Through Cmd Shell

Posted on 2010-11-17
16
1,098 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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 datatypes, explain the available data types and show how data can be passed into and out of variables.

791 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