Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Folder Cleaner Utility, Should I include a Log File?  (Read 3045 times)

0 Members and 1 Guest are viewing this topic.

Nexusfactor

    Topic Starter


    Rookie

    • Experience: Experienced
    • OS: Windows 7
    Folder Cleaner Utility, Should I include a Log File?
    « 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. 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.
    The world's #1 Antifeminist

    Geek-9pm


      Mastermind
    • Geek After Dark
    • Thanked: 1026
      • Gekk9pm bnlog
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 10
    Re: Folder Cleaner Utility, Should I include a Log File?
    « Reply #1 on: January 08, 2016, 11:59:15 AM »
    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.  :)

    camerongray



      Expert
    • Thanked: 306
      • Yes
      • Cameron Gray - The Random Rambings of a Computer Geek
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Mac OS
    Re: Folder Cleaner Utility, Should I include a Log File?
    « Reply #2 on: January 08, 2016, 06:41:48 PM »
    Adding that would be good.  It would also be good for it to show what it is going to delete before it does it!

    foxidrive



      Specialist
    • Thanked: 268
    • Experience: Experienced
    • OS: Windows 8
    Re: Folder Cleaner Utility, Should I include a Log File?
    « Reply #3 on: January 09, 2016, 11:10:59 PM »
    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