Windows 10: Scheduled task to delete files in network drive's trashbox by size or delete date?

Discus and support Scheduled task to delete files in network drive's trashbox by size or delete date? in Windows 10 Network and Sharing to solve the problem; Background: I have a Buffalo network drive that is used as a file server for two Win 10 Home PCs as well as for automated backups of my PC by Macrium... Discussion in 'Windows 10 Network and Sharing' started by OsakaWebbie, Aug 13, 2019.

  1. Scheduled task to delete files in network drive's trashbox by size or delete date?


    Background: I have a Buffalo network drive that is used as a file server for two Win 10 Home PCs as well as for automated backups of my PC by Macrium Reflect. I only recently discovered that it has something similar to Windows' recycle bin called "trashbox", but run by the driver or something, not by Windows. (I can tell this because Shift-Delete does not skip the trashbox like it does for the recycle bin on the C drive.) When my backups are purged because new ones are made, those backup images are staying in the trashbox, so the drive eventually fills up, and other files also come and go, but don't really go. Scheduled task to delete files in network drive's trashbox by size or delete date? ;) It would be nice to automate some cleanup.


    I could completely disable the trashbox feature in the Buffalo settings, but it's good protection against accidental deletion. What I'd like to do is delete from the trashbox any files that are larger than some size and/or have been deleted for some period of time.


    I found helpful tutorials about deleting files using ForFiles in a scheduled task, but the only examples were based on a search mask on the filename (that would work for the old backups, but not other files) or date modified (which is not the date deleted - apparently moving a file to the trashbox does not change its date). Is there any way to programmatically tell when a file was sent to the trashbox folder, or its size? Also, the files in trashbox contain their complete path (parent folders all the way to the root), so it would be nice to also write a task/batch file to remove empty folders from trashbox - I don't know how to do that either.

    :)
     
    OsakaWebbie, Aug 13, 2019
    #1
  2. Kreij Win User

    BAT File That Deletes Files Below Specific Size

    @travva : Doesn't your script delete all files in a directory that are over 1MB in size?

    Shouldnt that line be .... for %%j in (*) do if %%~zj lss 10000 del %%j ... to delete files smaller than 10k ?
     
    Kreij, Aug 13, 2019
    #2
  3. NinjaNife Win User
    BAT File That Deletes Files Below Specific Size

    I am wondering how to make a bat file that can delete all files below a certain size (in this case 10kb). I have a folder on my server that has game screenshots in it (taken by Punkbuster) and need to sort out the good shots from the bad, and figure this is easier than manually deleting thousands of files.. The "bad" shots (blanks with failed renders) range in size from 4kb-8kb, so the bat file can delete anything lower than 10kb with no issues. Is this possible, and if so how do I make one? Thanks for your help.


    *EDIT*
    I have found a bat file that can delete specific types/sizes, but it only allows you to delete file sizes of 0kb (empty text documents and such), and replacing the "0" with "10" or any other number hasn't worked for me so far.
     
    NinjaNife, Aug 13, 2019
    #3
  4. Mussels Win User

    Scheduled task to delete files in network drive's trashbox by size or delete date?

    BAT File That Deletes Files Below Specific Size

    why not just sort the folder by file size and manually delete all the tiny ones every now and then?
     
    Mussels, Aug 13, 2019
    #4
Thema:

Scheduled task to delete files in network drive's trashbox by size or delete date?

Loading...
  1. Scheduled task to delete files in network drive's trashbox by size or delete date? - Similar Threads - Scheduled task delete

  2. I deleted WindowsColorSystem task in task scheduler by mistake

    in Windows 10 Gaming
    I deleted WindowsColorSystem task in task scheduler by mistake: Hi,I deleted WindowsColorSystem task in task scheduler by mistake, and now I can't calibrate the color in my windows 10.I want to re-create the task but I'm not sure which details should be inputted. It continuously says 'Display Color Calibration can't save the new...
  3. Deleted task scheduler task

    in Windows 10 Gaming
    Deleted task scheduler task: Hi,I Accidentally deleted StartComponentCleanup in Task Scheduler. Is it possible to recover or re-create the deleted task? https://answers.microsoft.com/en-us/windows/forum/all/deleted-task-scheduler-task/0866d10b-9ef7-4bb7-8f0a-56b848500fa9
  4. Deleted task scheduler task

    in Windows 10 Software and Apps
    Deleted task scheduler task: Hi,I Accidentally deleted StartComponentCleanup in Task Scheduler. Is it possible to recover or re-create the deleted task? https://answers.microsoft.com/en-us/windows/forum/all/deleted-task-scheduler-task/0866d10b-9ef7-4bb7-8f0a-56b848500fa9
  5. Deleted task scheduler task

    in Windows 10 Customization
    Deleted task scheduler task: Hi,I Accidentally deleted StartComponentCleanup in Task Scheduler. Is it possible to recover or re-create the deleted task? https://answers.microsoft.com/en-us/windows/forum/all/deleted-task-scheduler-task/0866d10b-9ef7-4bb7-8f0a-56b848500fa9
  6. What is the "DataSenseLiveTileTask" task in task scheduler? Can it be deleted?

    in Windows 10 Network and Sharing
    What is the "DataSenseLiveTileTask" task in task scheduler? Can it be deleted?: In the task scheduler, there is a folder named "s-1-5-21-2881527052-4235384186-2555224567-1001", in which a task named "DataSenseLiveTileTask" is disabled and last run in November 1999. What is this thing for? Can it be deleted? Thanks for answering for me[ATTACH]...
  7. Running a script on file deletion with task scheduler.

    in Windows 10 Ask Insider
    Running a script on file deletion with task scheduler.: I'm trying to figure out how to run a (python) script whenever any file is deleted with task scheduler. I tried googling but with no success, all I found out was that the event ID for file deletion is 4660 I think, and it's probably under security logs. The problem is that...
  8. Permissions to delete files with Task Scheduler

    in Windows 10 Installation and Upgrade
    Permissions to delete files with Task Scheduler: Hi I have setup Windows Backup to utilise a spare internal hard disk, it works well. I have some large files which change quite regularly which are filling the disk quickly. I have setup a Scheduled task that uses Forfiles to delete old copies of these files, everything...
  9. Task Scheduler Restore Point deleted

    in Windows 10 Installation and Upgrade
    Task Scheduler Restore Point deleted: BACKGROUND: I am attempting to create a Restore Point on 4 different computers in my office. I am successfully able to manually create a restore point using powershell.exe. Action: -ExecutionPolicy Bypass -Command "Checkpoint-Computer -Description \"BDRE-CHRIS Restore...
  10. Task Scheduler Tasks copy file to mapped network drive fails

    in Windows 10 Network and Sharing
    Task Scheduler Tasks copy file to mapped network drive fails: I've read a dozen or so of the posts regarding Task Scheduler issues - so far haven't seen my issue solved. Tasks which functioned more-or-less in W7 were saved, then imported to a new PC with a fresh install of W10. They seem to have imported intact. They all call batch...