LBGUC04
asked on
Uncompress File Through Cmd Shell
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?
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
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
ASKER
thank you for yoru response but this must be done using a sql statement
If you already have the command then just use
EXEC xp_cmdshell N'COMMAND'
ASKER
I have tried the following but i just get an error
exec master..xp_cmdshell 'Extract "U:\TestExtract\test.zip", "U:\TestEx tract"'
Extract - Verity, Inc. Version 5.0.0 (_nti40, May 13 2003)
Usage: extract [-xnv] -credentials user[:password][:domain][: mailbox] basename collname [query]
exec master..xp_cmdshell 'Extract "U:\TestExtract\test.zip",
Extract - Verity, Inc. Version 5.0.0 (_nti40, May 13 2003)
Usage: extract [-xnv] -credentials user[:password][:domain][:
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"
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"
ASKER
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
Does the extract command that you ran inside of the xp_cmdshell work normally?
ASKER
i have never used it before i got it from the link above
Could you answer my original questions please?
ASKER
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]
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][:
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi LBGUC04,
Please share your solution :-)
Please share your solution :-)
ASKER
--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)
declare @sql varchar(8000)
set @sql = 'exec master..xp_cmdshell ''UNZIP -j -o U:\TestExtract\test.zip -d U:\TestExtract'''
print @sql
exec (@SQL)
ASKER
i have the answer
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?