File and Folder Purge

MSSG_RRD
MSSG_RRD used Ask the Experts™
on
I'm looking for a third party tool to automatically delete the files and folders based on the predefined retention period for our file servers. The conditions for the deletion criteria is as given below.

1. File creation date
2. File Modified date.
3. File last access date
4. Folder creation date
5. Folder Modified date.

The above conditions varies from client to client.
Please help me in finding a good tool
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
AlexA lack of information provides a lack of a decent solution.

Commented:
You can do that in a script but you need to give me more info, as in

1. File creation date - What date, are you wanting specific dates or are you wanting a time frame
2. File Modified date. - Modified in what time frame?
3. File last access date - What time frame
4. Folder creation date - Details again
5. Folder Modified date. - As above.

if you wanted things modified in the past 180 days the below would do it

get-childitem "Location" -recurse | Get-ChildItem |  Where-Object {($_.LastWriteTime -lt (Get-Date).AddDays(-180))} | Remove-item -force -recurse -whatif

Open in new window


Remove the whatif to delete files.

Regards
Alex

Author

Commented:
Hi Alex,

Thanks for your prompt response.

At present we have a same kind of script running as a service in our server, how ever we see that there are some issues like, we are not able to get that failed event, its cause for failure is not available. Hence we are looking for a tool which is a schedule based run option, send the report which has the failed events, exceptions etc.. as an email to the respective client.

Moreover our IT management is looking for a licensed tool which satisfies the needs.
AlexA lack of information provides a lack of a decent solution.

Commented:
In which case I cannot help you because that sort of application doesn't exist. Your best option would be some sort of file archiving software which then moves the data to tape/disk and then leaves a stub.

This in it's own right causes issue for migration at a later date.

Oh also,

The above conditions varies from client to client.

since it's varies you'll need to set up multiple rule sets for this. Even then I can pretty much guarantee that it's going to go wrong.

Regards
Alex
Most Valuable Expert 2018
Distinguished Expert 2018
Commented:
Well, there's the File Server Resource Manager feature for free in Windows Server:
File Server Resource Manager (FSRM) overview
https://docs.microsoft.com/en-us/windows-server/storage/fsrm/fsrm-overview
To expire old files, see the section in File Management Tasks  > Create a File Expiration Task

As far as your criteria are concerned, some comments
1. File creation date
Treacherous. When a file is copied, the creation date will (usually) be the date when the file was copied, so a file can have today as creation date, and a "last modified" date from 10 years ago.
2. File Modified date.
This is usually pretty safe to use, but obviously doesn't tell you whether the file has been read 50 times daily for the last 10 years.
3. File last access date
Treacherous. May be updated by all kinds of background processes, like virus scanners, indexing tools, ...
4. Folder creation date
Highly treacherous, see "File creation date"; in addition, the folder creation date doesn't tell you anything about when the last file or subdirectory(!) was modified.
5. Folder Modified date.
Highly treacherous. A directory's Modifed date is only updated when a file is added or deleted, not when a file inside this folder is modified.

So never, ever, delete directories automatically based on their time stamps.

Author

Commented:
Thanks everyone for your recommendations and solution. It was very helpful.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial