| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
||||
|
modify every file on a drive at once
Long Story Short
I need an easy way to remove "FILE.VBS" from EVERY single ZIP file on each partition of my hard drive. Short Story Long I couldn't think of a good title for this thread. My problem is this: On Saturday, I realized that I had some kind of Trojan on my PC. Normally, this is absolutely no problem. Trojans are easy to remove and move on from. But this one is a major pain in my ass. Virus Scaners like ClamWin detected it as a Worm. It calls itself GedZac Labs in each of its infections. I've easily gotten rid of the Worm. It added a file, "FILE.VBS", to every ZIP file on my hard drive (via pkzip that it places inside your system dir) it infected EVERY htm, vbs, js, php, (and many other files) file on my hard drive by appnding itself as VB Script to the each file. Saturday, I got rid of the worm. Sunday, I finished manually disinfecting all my html files I wanted to keep Now today is monday, and I'm still trying to find a practical way to fix the zip files. I have 8 Hard Drive Partitions, and I easily got rid of these files manually from 7 of them, but my backup drive, H, has hundreds of ZIP files, and I need to find a quick way to remove this file from each zip file. here's what I've tried so far: Dos Commands: dir c:\ d:\ e:\ f:\ g:\ h:\ i:\ j:\ /a /s /b > file.txt find ".zip" file.txt /i > zips.txt that made a list of every zip file in every folder on every hard drive that I have, and I wrote a VB6 program to open up the zips.txt file and add "pkzip -d " to the beginning of each line, and " file.vbs" after each, and renamed the zips.txt to zips.bat. now zips.bat is a batch file that will use pkzip to remove file.vbs from every zip file on my machine. Only one problem: pkzip doesn't accept windows style paths. it needs 8 character file names or shorter, and no spaces. now dir /x will give you the short versions of a directory list, but cannot be used in combination with /b, bare format, which is neccessary to remove all the junk from the DIR command ( it prints ONLY file names one line at a time ). I've also thought about writing a program to just scan every folder for *.zip files, and then save its path and convert it to "dos format", but that will also be a pain in the ass. One way that I found to work (sort of), is using the DOS command "DIR /x /p" in a folder where there are a lot of ZIP files, and manually selecting the text of each "short format file name", and pasting it into a text file, and running my program on it to add the PK zip command to it, put pkzip and that batch output file into the directory, and watch each file get fixed. but that only works for folders with lots of files, I mostly just have lots of folders :-p Any Ideas??? edit: seems the dos version of 7-Zip works with long path names if you put it in quotes, I'll try that soon. still in need of more practical ideas though.
__________________
Interactive Entertainment | Let me get this straight... these people adamantly believe that all this hard evidence of evolution is nonsense, but yet adamantly believe that some geenie popped out of a bottle at the beginning of time, did a little dance and some hokus pokus, and created life.... Last edited by LabRat404 : September 12th, 2005 at 01:27 PM. |
|
||||
|
Stoopid question... is there a .zip utility for linux that will accept long names? Perhaps you could run a linux script to accomplish your goal.
__________________
Ask Questions the Smart Way ![]() "I like doggies....and apparently dinousaurs, mostly because they eat cats!" --Nilpo Enable BSOD: Control Panel/Systems, Advanced Tab, hit the Settings button under Startup and Recovery, and under the System Failure area, uncheck the Automatically Restart checkbox. |
|
||||
|
This seems to be the easiest solution:
dos command: DIR h:\ /a /s /b > 1.txt that will create a file, "1.txt", containing the relative path of every file on the hard drive one entry per line. run my stupid VB6 program (because I really don't feel like spending the extra time to write a C program for this one time situarion...though I'm starting to feel a little inspired ;-) the program reads in every line that ends with ".ZIP" from the file "1.txt" case insensitively via ucase(). it then appends the line to "3.bat" with some other varialbles as follows: "7za -d " & chr(22) & TheLine & chr(22) & " file.vbs >> log.txt" which ends up looking something like this: 7za -d "H:\path\path\archive.zip" file.vbs >> log.txt then run 3.bat, and watch all those annoying little file.vbs files dissappear from all my precious .ZIP files across the entire H drive. BAM like SPAM. now, search for any file access problems in log.txt, and the few that it finds can be done manually. Last edited by LabRat404 : September 12th, 2005 at 02:35 PM. |
|
||||
|
This might help you.
Couldn't be bothered reading the post (Ahh sue me) but i saw something to do with linux, so don't know if this will work. But should work on the other OS's you've got running.
__________________
![]() DynaSig: Free Dynamic Forum Signatures! ----------You don't need a reason to help someone...----------- |
|
||||
|
Quote:
definately an interesting program. you couldn't read the one sentence under Long Story Short? oh well, thanks for posting anyhow :-) |
|
||||
|
Boot up with a live cd.. mount your drive (read-write).. replace / with the path to your drive.. and let her rip.
find / -name *.zip -print |xargs -i zip -d {} FILE.VBS Be aware that FILE.VBS is case sensitive. |
|
||||
|
Quote:
I've got slackware so I'm all set. that almost works, but the paths contain spaces so I've got to throw in quotes around the file and path with escape characters. Also, the ZIP extentions may be in any case, so case insensitivity is important for the "find" command. find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS I've also got to output everything to a log file, so I can go through and pick out files that it had trouble with. the "zip" command won't output errors to a file via ">" with cygwin, so that doesn't look like it will work. I think I'm just going to do this: find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS \>\> log.txt >> dos.bat boot into windows, and run dos.bat. that should do the trick. this is much the same as my idea for writing a program to format file output from a dir command, but much much easier. Last edited by LabRat404 : September 13th, 2005 at 12:30 PM. |
|
||||
|
Quote:
Couple of comments, though. dos.bat isn't going to end up with anything in it.. but I don't think you really need it, since xargs executes zip for each element. Unless you were doing something else with the zips later? Also, the output for zip errors will be to stderr (descriptor 2) and the backslashes on the redirection confuses zip.. a workaround to that is.. (find / -iname *.zip -print | xargs -i zip -d \"{}\" FILE.VBS 2>> log.txt) 2>> dos.bat But dos.bat still ends up empty. =) If you have cygwin you may be able to do the whole thing from windows. |
|
||||
|
Quote:
what I meant was this: $ find / -iname *.zip -print | xargs -i echo zip -d \"{}\" FILE.VBS \>\> log.txt >> dos.bat the difference is that I echo the command to a file, dos.bat. Yes, the errors wouln't output to the file as I expected, so thanks for the info on the descriptor 2 thing. Using xargs and zip in combination with the escaped quotes on boths sides of the {}, there was some issue passing the command to zip, and zip complained. I was forced to write the command as output to a file, and execute the file; it also seems '-print' is automatically specified with the 'find' command: $ find /mnt/win -iname *.zip | xargs -i echo zip -d \"{}\" FILE.VBS >> ~/script $ chmod a+x ~/script $ ~/script I also had to perform a "find and replace" on the file "~/script" within kwrite, and change all single quotes within file paths to \' otherwise xargs complained. Other than that, it worked. However, I will have to do it one more time with the 2>> to find which files "zip" had problems accessing. I had cygwin, but I scrapped the installation because it had some issues. I'm going to reinstall soon. Here's a weird thing: I have each of my windows partitions, c through i, and my win2k partition mounted under /mnt/win as /mnt/win/c, /mnt/win/d, ..., etc, and /mnt/win/2k. if I did this from my home directory: $ find /mnt/win/c -iname *.zip it would only find a few of the many zip files. if I then did this: $ cd /mnt/win/c $ find ./ -iname *.zip that would find all them! maybe theres a bug in 'find'? or maybe theres some rule I'm unaware of when searching mounted drives? edit: edited the hell out of this post. it's perfect now :-) Last edited by LabRat404 : September 14th, 2005 at 11:00 AM. |
![]() |
| Viewing: Dev Hardware Forums > SOFTWARE > Software > modify every file on a drive at once |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|