need a sample powershell script which will delete the file older than 3 days
Posted on 2011-10-20
I have file server which keep log data of many applications.
log data will created for many applications.
log data will be created for an application,only if there is any errors get generated.
for each application logs will be generated under specific folders.i.e. each application logs are maintained under separate folder.
so i am looking for a script which will dynamically calculates the date of files under each folder in e: drive and delete log files which are older than 3 days.
I don't to dependent upon schedule task, whenever new files is created and if it finds a files which are older than 3 days in that path, it should delete it immediately.