![]() Display all items in your Trash and selectively delete desired items.Execute several maintenance scripts to solve specific issues on your Mac.Show all apps and processes launched at login and disable them with one click.Discover the space occupied by files and folders thanks to a visual interactive map.Scan a folder for duplicates, compare versions and delete unwanted ones.Remove all these files you really don’t need (Windows files, incomplete downloads…).Delete other system files like Xcode files, crash reports, Mail downloads, orphans….Remove system caches in order to solve some issues and free up hard disk space.Automatically check for updates for apps installed on your Mac and display the change log.Manage a list of favorite apps and store registration info (invoice, license key…).The Smart mode will automatically open TrashMe when you put apps in the Trash.TrashMe will find all related files to be removed for an app, like preferences, caches, logs…./XD C:\dir1 C:\dir2 C:\TrashMe is my list of blacklisted folders.TrashMe 3 lets you clean your Mac and uninstall your apps, the perfect way./R:1 /W:1 is the number of retries and wait time between if file is locked and can't be deleted./CREATE will create zero-based files instead of the original source file./MINAGE:365 will exclude all files which are newer than 365 days./MOVE will cut&paste all found files instead of copy&paste them.*.cfg *.hdr *.txt *.dat are wildcards and will filter for certain file extensions.C:\TrashMe is the (temporary) target folder for all found files.C:\ is the source folder which should be scanned.robocopy calls C:\Windows\System32\Robocopy.exe which is preinstalled on Windows Server 2003, Vista, 7 and 8.This speeds up the command move and delete part. The trick is to use the /CREATE switch so robocopy will create zero-byte files instead of the actual source file. The last action is to remove the trash folder containing all found old files which. You exclude multiple folders with the /XD switch. ![]() Robocopy will than move (not copy!) all desired files (correct extension and modified time stamp older than 365 days) to that trash folder. The batch will create a temporary trash folder named TrashMe. Robocopy C:\ C:\TrashMe *.cfg *.hdr *.txt *.dat /MOVE /E /MINAGE:365 /CREATE /R:1 /W:1 /XD C:\dir1 C:\dir2 C:\TrashMe You can misuse Robocopy to delete old files, filter for certain extensions and exclude multiple directories from scanning - all in one command. Nevertheless I want to share what I have found. And if the blacklisted folders list grow my Robocopy command will look ugly. I think MBu's answer is better than mine since it doesn't rely on an external tool like Robocopy. I am afraid it may break on folder names containing special characters like % or ^. The file should contain full paths to excluded folders without quotes: D:\excluded folder1įor each folder that is not blacklisted a subroutine is called which searches for files based on extension and then each file's date is compared with the date given. The blacklist should be stored in blacklist.txt file in the same directory where the script resides. I had to get rid of /r switch and call a subroutine recursively or the blacklist would not work properly. I think I have managed to modify the script to work the way you want. If not, the comparison will not work as expected. You can try this script but it will work only if %%~tA in your regional settings is returning the file date using YMD format. modified time is more than 365 days oldįorfiles /s /m *%%i /d -365 /c "cmd /c del of three issues are solved, but how do I exclude a given set of folders.If all following conditions are true, delete the file Search all files in all folders and subfolders starting at the folder where the batch is placed. The yes and no file names demonstrate which files should be deleted What I want │ no.hgr | file is too new, modified within a year │ no.dat | file is too new, modified within a year I want to delete certain files via batch, but exclude a given set of paths to be checked Example structure E. I decided to use a fixed list of folders to exclude. Edit: After answer I realized that my first approach with leading numbers in folders as criteria to exclude isn't the right way.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |