sevalav
J have zipped folder in C:\Users\Optika Stevanovic\Desktop\Fakture_RFZO.zip
Inside this zipped folder J have folder META-INF and file mimetype.
With shell I need to delete both folder and file.
Can someone help me?
----------------------------
#2 09 May 2013 09:55
npocmaka
try with 7z.exe and delete option:
http://www.dotnetperls.com/7-zip-examples
download :
http://www.7-zip.org/
----------------------------
#3 09 May 2013 14:11
sevalav
I will rather prefer to do this with Windows, I want to avoid other programs. Anyway, thanks for tips.
----------------------------
#4 09 May 2013 14:19
sevalav
Another reason is that I can not see on download page 7-Zip Command Line Version for 64-bit Windows.
----------------------------
#5 09 May 2013 14:21
npocmaka
Then you should use EXPAND/COMPRESS/DEL - EXPAND and COMPRESS are the commands that works with zip but I'm not sure how they manage with folders.
Or you can try with VBSCRIPT - it works with zips in similar way as the file system and if you modify this script you can delete the manifest content.
----------------------------
#6 10 May 2013 10:01
npocmaka
With my brand new hybrid kung-fu
Code: Select all
'>nul 2>&1|| copy /Y %windir%\System32\doskey.exe %windir%\System32\'.exe >nul
'&&@echo off && cls &&goto :end_vbs
private const FOF_NOCONFIRMATION = 16
Dim objShell, objSource ,objFolder
' Create the required Shell objects
Set objShell = CreateObject( "Shell.Application" )
' Create a reference to the files and folders in the ZIP file
Set objSource = objShell.NameSpace( "c:\test\test.zip\inzipfolder").Items( )
Set objFolder = objShell.NameSpace("C:\tobedeleted")
if ( (not objFolder is nothing) and (not objSource is nothing) ) then
objFolder.MoveHere objSource , FOF_NOCONFIRMATION
end if
set objFolder = nothing
set objShell = nothing
'Set objFSO=CreateObject("Scripting.FileSystemObject")
'fso.DeleteFolder("c:\del")
WScript.Quit
:end_vbs
'& md c:\tobedeleted
'& cscript /nologo /E:vbscript %~f0
'& rd /s /q c:\tobedeleted
'& pause
If you mind to use doskey for doing nothing you can check this .exe that I've created especially to be used fo such type hybrid scripts:
https://dl.dropboxusercontent.com/u/96959329/hvbs/'.exe
(you add it to the PATH variable or simply to put it in system32)
Last edited by npocmaka (19 Jul 2013 07:57)
----------------------------
#7 10 May 2013 12:14
npocmaka
Code: Select all
'>nul 2>&1|| copy /Y %windir%\System32\doskey.exe %windir%\System32\'.exe >nul
'&&@echo off && cls &&goto :end_vbs
ZipFile = WScript.Arguments.Item(0)
FolderName = WScript.Arguments.Item(1)
TempDir = WScript.Arguments.Item(2)
private const FOF_NOCONFIRMATION = 16
Dim objShell, objSource ,objFolder ,objSourceParent ,objParentFolder
' Create the required Shell objects
Set objShell = CreateObject( "Shell.Application" )
' Create a reference to the files and folders in the ZIP file
Set objSource = objShell.NameSpace( ZipFile & "\" & FolderName ).Items( )
Set objSourceParent = objShell.NameSpace( ZipFile & "\" & FolderName &"\").ParseName(FolderName)
Set objParentFolder = objSourceParent.GetFolder
set objFolder = objShell.NameSpace(TempDir)
if ( (not objFolder is nothing) and (not objParentFolder is nothing) ) then
objFolder.MoveHere objSource , FOF_NOCONFIRMATION
objFolder.MoveHere objParentFolder , FOF_NOCONFIRMATION
else
WScript.Echo "Folder not found in the zip"
end if
set objFolder = nothing
set objShell = nothing
set objParentFolder = nothing
set objSourceParent = nothing
WScript.Quit
:end_vbs
'& if "%~2" equ "" echo usage : %~n0 zipfile folder name && exit /b 3
'& if "%~1" equ "" echo usage : %~n0 zipfile folder name && exit /b 2
'& md %temp%\tobedeleted
'& set zipFile="%~f1"
'& if not exist %zipFile% echo zip file does not exist && exit /b 1
'& set folderName="%~2"
'& cscript /nologo /E:vbscript %~f0 %zipFile% %folderName% "%temp%\tobedeleted"
'& rd /s /q %temp%\tobedeleted
'& rem pause
If I open the zip with windows explorer the folder looks deleted.But when I try with some archiver (WinZip, 7zip) it appears again.
Last edited by npocmaka (10 May 2013 13:20)