![]() ![]() A deletelog.txt file is created to report on all file and folders that have now been removed.Īs always, please share below your PowerShell automation scripts to possibly add to or better the script shared above. Executed the above script (thinking it is something name related) and trying to delete files that are older than 3 days. I did a rsync of the undo folder on a test one. find has options to read files creation ( ctime ), access ( atime ) and modification ( mtime ). The latter half of the script deletes any folders or subfolders now empty after the purge. All the files older than 3 days will be deleted. Bash - Delete Files Older Than 10 Days Using Shell Script in Unix - Stack Overflow - Free download as PDF File (.pdf), Text File (.txt) or read online for. Sometimes, you may need to delete files older than x days. $_.FullName | Out-File C:\log\deletedlog.txt -Append I know I can list all files with ls in a the folder containing the files. I'm new to bash, I have a task to delete all files older than 30 days, I can figure this out based on the files name YMD.ext 20190430.txt. D -30 means older than 29 days. Delete all files older than 30 days, based on file name as date. PS: Run in a command prompt window forfiles / and read the output usage help if you really want to use this Windows command ever again. type f -mtime 30 files older than 30 days herong rm find. Get-ChildItem $Folder -Recurse -Force -ea 0 | 2 days ago
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |