12/31/2023 0 Comments For android instal TrashMe![]() ![]() 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 |