In MacUpdate Desktop, right click on any app and select "Delete with AppDelete".There are several ways to activate AppDelete: This allows you to delete apps right from within MacUpdate Desktop by right-clicking on it and asking AppDelete to delete it. AppDelete technology is also integrated into MacUpdate Desktop. You can also undo the last delete if you choose. The items will not be removed from your computer until you empty them from your trash. The items you delete will be moved to the trash and arranged in a folder so that you can see exactly what was deleted and you know exactly where it came from. Without AppDelete these associated items will be left behind to take up space and potentially cause issues. /XD C:\dir1 C:\dir2 C:\TrashMe is my list of blacklisted folders.AppDelete is an uninstaller that will remove not only applications but also widgets, preference panes, plugins, and screensavers along with their associated files./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 |