MediaSmartServer.net
http://www.mediasmartserver.net/forums/

Automatic deletion of files by date
http://www.mediasmartserver.net/forums/viewtopic.php?f=4&t=3896
Page 1 of 1

Author:  KaiBo [ Tue Mar 31, 2009 8:10 pm ]
Post subject:  Automatic deletion of files by date

Just clicked this little PowerShell-Script together to get rid of some files which are being constantly being created but won't be used anymore if they get too old. Thought that some of you might have a use or two for it as well (think of logs):
Code:
Get-ChildItem -incl '*.mp4' -path 'd:\shares\users\axis\*'|
?{$_.LastWriteTime -lt (get-date).AddDays(-7) -and !$_.PSIsContainer}|
remove-item

What it basically does: Delete every .mp4-File from c:\shares\users\axis which is older than seven days. Feel free to adapt it as necessary.

If you put " -whatif" at the end of it all it will just show you which files are selected by the above statement instead of deleting them.

Page 1 of 1 All times are UTC - 7 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/