I have the following batch file for deleting files whose path & filename are stored in a file. It works fine. I can put the path and file name of the files I want to delete in DELETE-ALL.txt and the batch file will delete them. For example, if there is an entry - "download\test.txt"- in the file, it will be deleted from several drives.
There is one problem though. If the entry is just "download\" without any file name, all files, but not folders, under "download\" will be deleted. This is certainly not good. Anyway to modify the batch file so it'll ignore entries that have nothing after "\" (entries ending with a "\")? Or maybe there are other ways to achieve the same thing?
@REM This script deletes files which include path.
@ECHO Working...
@if exist C:\DELETE-ALL-LOG.txt DEL /Q C:\DELETE-ALL-LOG.txt
@(@for /f "tokens=1 delims=;" %%A in ( C:\DELETE-ALL.txt) do @(
@DEL /Q /A "D:\%%A"
@DEL /Q /A "E:\%%A"
@DEL /Q /A "K:\%%A") >> C:\DELETE-ALL-LOG.txt 2>&1)
@endlocal
@CD /D C:\
@echo Done. 3 Reset to default