1

I have windows base File sharing server (with above 100 shared folders for users) for users where users copy there files on daily basis for backup purposes. Some users forget to do this, and after many days or in disaster recovery, it apper that user was not maintaining his backup folder. This creates problem for IT Dept. At a moment we check every user by daily browse throught there folders and sort by last modified.I want to this with some scripting.

Folders Structure is as following

D:\Backup

D:\Backup\User1\Folder1 [contains main backup files of user] D:\Backup\User1\Folder2 [contains junk data only for user]

D:\Backup\User2\Folder1 D:\Backup\User2\Folder2

and so on

Now I want to list folder names which are not updated(modified) in last X days. ) but only FOLDER1 should be scanned which contains the actual backup files)

  • 1
    Completely unrelated to the question, but you should never make a user reliable for storing backups. Create a system that will backup regardless and make people use it. For example, make them store their files on the network, and use redirected folders to make their userprofile also reside on the network, then you can backup these folders serverside. – LPChip Apr 14 '16 at 14:14

2 Answers2

0

You can write a script for this to make things fancier, but I suggest navigating to the folder and using the Windows built in search: modified:<YYYY-MM-DD hh:mm:ss
This will check all files that were modified before the given date.

To check for folders only, you can add: kind:folders
To check for files in a given foldername only, use: foldername:Folder1

You can customize your search with additional values.
Here are some advanced search options that you can use.

Divin3
  • 1,803
0

You have not mentioned which OS you are using. I'll assume Windows 8.1, Windows 10 or Windows Server 2008 R2 or later.

There's a command you can use that does exactly what you want.

Its called forfiles

This commandline utility will list all files in the current folder (and optionally all subfolders). You can apply a filter on this huge list like a query. One of the options is its advanced date system. Not only can you choose all files before or after a certain date, you can also do the same for a specific amount of days.

The command would be something like this:

forfiles /s /m FOLDER1 /c "cmd /c forfiles /p @path /s /d -30"

This would show all modified in the last 30 days for these specific folders.

LPChip
  • 61,264