1.

Solve : Folder Cleaner Utility, Should I include a Log File??

Answer»

I'm developing a command line utility that will remove sub-directories/files BUT leave the parent folder. My question is, should I include the ability to write the deleted sub-directories/files to a log file, so the user could see what was deleted?

CCleaner, will empty a folder but won't show what files it removed. BleachBit, does show the files/folders it deleted.

Any feedback would be great. IMHO, it is always good to have a record of what you did. A log file wail use very little space than the size of the files removed. Adding that would be good. It would also be good for it to show what it is GOING to delete before it does it!QUOTE from: Nexusfactor on January 08, 2016, 10:31:00 AM

I'm developing a command line utility that will remove sub-directories/files BUT leave the parent folder.

This should do that job: it's untested.
Remove the rem to create the log file.

Code: [SELECT]@echo off
:: removes the files and folders under %1 but leaves the %1 folder
set "folder=%~1"

if not "%~1"=="" if exist "%folder%\" (
rem DIR "%folder%" /b /s /a-d >file.log
pushd "%folder%" && (rd /s /Q /f "%folder%" >nul 2>&1 & popd)
)
pause


Discussion

No Comment Found