Delete a list of files in a txt file

Hewlett-packard Compaq presario r3000z c...
March 1, 2010 at 18:37:03
Specs: Windows 7, 2.699 GHz / 759 MB
I'm trying to COMPLETELY remove/uninstall some programs. I used InstallWatch pro before installation, and it gives me a list of all files added to the computer at time of install in a .txt format. The uninstall feature for the app does not remove ALL of those files. I can go through that .txt file line by line,navigate to and manually delete each file that was left behind, but that is too time consuming. Is there any way to simply modify that .txt file and rename it to a .bat or something, where I can add a header or code saying "delete all of the following files from my computer"? Obviously I'm sure it would be slightly more complicated than that, but could anyone point me in the right direction as to how to do this?

See More: Delete a list of files in a txt file

Report •


#1
March 1, 2010 at 18:56:56
This script should do it, BUT. Some files may be needed by other apps. This happens, especially with DLLs.

----------------------------------
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in (filelist.txt) do (
if exist "%%a" del "%%a"
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
March 2, 2010 at 03:59:39
I would not delete the DLL's, but move them to another location. These files can be very tricky, I would trust nothing that says : these DLL's are not needed anymore. Even if it is MS itself. Move the files to another location, restart your computer (see if it even boots), then use your system as normal. Watch for any special behaviour. If anything goes wrong, and if you are lucky, he will complain on some or another DLL missing. Then you need to know where to put it back again, apart from having a copy of that file.

Report •

#3
March 2, 2010 at 08:06:14
Thanks I'll give that a try, but a few quick questions. Besides the file name of the .txt file, would I need to replace any of the code with path names or anything else, or use it just as is? I have written a little VBA, but never anything else! I'm also assuming that this would be a .bat file also, am I correct? And finally, in the .txt file, what format does that need to be in? I beleive right now the first line is like a header, and every after is the path and filename of the added file (the one I want to delete).

On an added note, this particular software has no .dll's, but I plan on using this same process for other apps I want to remove in the future and will look out before deleting them. Thanks.

What about this though... is there any way write something to first take that .txt file, copy all files listed in it to a temp directory, then run the delete files code you provided, then if after reboot, there are errors, create another .bat file to re-copy the files from the temp directory back to their original location???

I know I can do all this file by file manually, but I'm looking for something to automate the process.


Report •

Related Solutions

#4
March 3, 2010 at 08:07:30
Yes, it needs to be a .BAT file.

In the filelist you need path and name, like this:

C:\temp\-\d10\gtest\tok\y\z\jud\quiz\STDERR.JUD

And yes, probably a good idea to move the files, then if it turns out they are needed, you'll still have them.


=====================================
Helping others achieve escape felicity

M2


Report •

#5
March 3, 2010 at 12:06:47
> What about this though... is there any way write something
> to first take that .txt file, copy all files listed in it to a temp
> directory, then run the delete files
> code you provided, then if after reboot, there are errors,
> create another .bat file to re-copy the files from the
> temp directory back to their original location???
>

I would not automate too much here, but just soppose this:

1. In the first place, you could have a script, with lines like:

move "C:\program files\program X\some.dll" "C:\restore_dir\program X"

2. Based on the above, it would be easy to switch some of these names:

move "C:\restore_dir\program X\some.dll" "C:\program files\program X"

... et, voila.


Report •

#6
May 26, 2010 at 17:31:12
Excellent works! Thank you all for posting this solution. It works great for me to delete over 100+ old duplicate files. Just want to learn if we can output delete files to a log? Thanks.

Report •


Ask Question