If u've faced a situation where u've unzipped a zip file to a wrong folder which had a zillion files originally and now all the files r mixed, then u'd know the pain to do this:
1. look in zip file
2. go to folder & delete the file u just looked up
3. repeat untill all files r done!
here's some help... this script will ask for the target folder and then the compressed file and clear the files from the target folder that are also there in the compressed file.
Reqmts : WinRAR (change path in script)
though u can change the script to adapt it to any utility supporting cmd-line extraction, i've chosen winrar coz of its support for many archive types, its fast and i like it!
Edit: changed script... i think this is a better method... and yeah it now also displays a list of files removed.
;___________________________________________ ;______De-Unzip Script______________________ ;This will remove files which are accidently ;extracted to a folder from a compressed file. ;___________________________________________ ;Enter path to WinRAR here: WRARPath = E:\Program Files\WinRAR\WinRAR.exe ;___________________________________________ SetBatchLines, 10ms ;Caution Message Coordmode, tooltip, screen ToolTip, ATTENTION! Please BACKUP the target`nfolder before running DeUnZip, 330, 300 sleep, 4000 ToolTip FileSelectFolder, Folder,,, Select Target Folder ifnotexist, %Folder%, exitapp FileSelectFile, Archive, 1,, Select Compressed File ifnotexist, %Archive%, exitapp ;Remove if already existing temp files FileRemoveDir, %temp%\DeUnZip, 1 FileDelete, %temp%\DeUnZip.tmp FileDelete, %temp%\Deleted Files.txt ;extract compressed file again to temp folder RunWait, %WRARPath% X -o+ "%Archive%" "%temp%\DeUnZip\",,min ;generate file list Loop,%temp%\DeUnZip\*.*,, 1 { FileAppend, %A_LoopFileFullPath%`n, %temp%\DeUnZip.tmp } ;Delete files & generate report Loop, Read, %temp%\DeUnZip.tmp, %temp%\Deleted Files.txt { StringReplace, NewPath, A_LoopReadLine, %temp%\DeUnZip, %Folder%, A IfExist, %NewPath% { FileAppend, %NewPath%`n FileSetAttrib, -R-H-S, %NewPath% FileDelete, %NewPath% } } ;The next loop removes empty folders RemFldr: Loop, e:\stuff\cracking\*.*, 2, 1 { ifinstring, A_LoopFileFullPath, .zip, continue Current = %A_LoopFileFullPath% total = 0 Loop, %Current%\*.* { total ++ } ifequal, total, 0 { FileSetAttrib, -H-R-S, %Current% FileRemoveDir, %Current% IfNotExist, %current%, setenv, Done, Yes } } ifEqual, Done, Yes { Done = No Goto, RemFldr } ;clear temporaries Run, %temp%\Deleted Files.txt FileRemoveDir, %temp%\DeUnZip, 1 FileDelete, %temp%\DeUnZip.tmp FileDelete, %temp%\Deleted Files.txt