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. Deleted external drive files

    in Windows 10 Network and Sharing
    Deleted external drive files: I tried posting in the technical community but no one replied. Windows 10 was updating and seemed to add my external WD drive to a Storage Spaces. When I tried to recover it using a restore tool it turned the files into something it doesn't recognize when I try to open...
  3. deleted flash drive files

    in Windows 10 Network and Sharing
    deleted flash drive files: can deleted files from a flash drive be recovered? If so how. https://answers.microsoft.com/en-us/windows/forum/all/deleted-flash-drive-files/92e36e7f-77fc-49c0-bccd-f23130f3aff4"
  4. Delete files from multiple folder through Task Scheduler

    in Windows 10 Customization
    Delete files from multiple folder through Task Scheduler: Hi, I want to Delete multiple files from multiple folders through Task Scheduler. Is there a command that can execute this requirement? The forfiles script is working for single folder but my expectation is to delete multiple files from two or few folders selected in the...
  5. Network usage as a codition for Task Scheduler

    in Windows 10 Performance & Maintenance
    Network usage as a codition for Task Scheduler: I'm trying to create a task in Task Scheduler to automatically Hibernate my PC when it is idle. To save power, cause it is staying powered on 24/7, I've set the power plan to never shutdown or sleep or hibernate after some time, because I often forget to disable this when I...
  6. Deleting Networks

    in Windows 10 Network and Sharing
    Deleting Networks: How do I delete networks from my list of networks I can connect to on my windows 10 laptop? https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/deleting-networks/0123d774-ad86-4d70-8583-a1ba5cf98216
  7. How to disable/delete scheduled tasks automatically when rebooting?

    in Windows 10 Support
    How to disable/delete scheduled tasks automatically when rebooting?: I have several scheduled tasks from an app that keep reappearing in task scheduler with each reboot. If I disable them or even delete them they just reappear each time I reboot my PC. If I disable them they stay disabled until the next reboot. Is it possible to set up a...
  8. Sort deleted emails by delete date

    in Browsers and Email
    Sort deleted emails by delete date: When you delete an email, it goes to the deleted email file and is sorted by the original date received. Is there a way to sort the deleted emails by the date they were deleted? Thanks Debby Durden 57340
  9. file save & task scheduler

    in Windows 10 Network and Sharing
    file save & task scheduler: I save my backup files on a separate PC which I am using for storage of pictures . how can I setup the task scheduler on my main PC to start my 2nd PC to backup my files, and after 30minutes using the task scheduler on PC 2 to ask if I wanted to turn of the PC? can any one...
  10. Delete Thumb.db files in network drive Win 10 Home

    in Windows 10 Support
    Delete Thumb.db files in network drive Win 10 Home: Can someone tell me how to delete all Thumb.db files on my network drive? I have Windows 10 Home, and want to delete thumbnail files in my folders that are on a Synology NAS. Windows error: thumbs.db file in use", so I can't delete it. other solutions include using...