Find Name And Remove Oldest

Find Name And Remove Oldest

I need a program that i can run on a Windows 2003 machine.

Best would be a .exe file – but .php will work also.

I need a script that can to do this:

1. scan this folder


2. Look for all files with the extenstion *.id – that might exists within that folder.

3. All the *id files has a first name of

example names below (three clients):

4. I then need the script to look inside each and every one of the *id file(s) thas is found.

within each id file i have a client name such as:


The above is an example name of three clients (computers).

They all have the above name strucutre – but the names are very radom the three letters in the middle and the number.

I want the script to look if the same client name exists within one or more *.id file(s).

It should only be one *id file with one client name. There should never be several *id files with the same clients name.

5. if the script does not detect that an client name exists in more than one *id file – the script can exit nicely.

6. If the script does detect that a client name does exist in more than one *id file – the script should first:

* create this text file: c:\DMDS\Cleanup\duplicate-client-name-exists.mvg

* create this file: C:\cDMDS\Cleanup\files-to-remove.bat

Within the files-to-remove.bat i want then name of *id file that should be remove:

The “files-to-remove.bat” should hold the name of the oldest id file that is a duplicate.

7. so i want to find duplicate files (that has the same client name twice) – and i want to keep the newest of the id files and only remove the oldest.

then i want the oldest name inside that .bat file so i can remove it.

8. I also need the script to output debug information to a log file somewhere so i can see what its doing.

i plan to schedule this script to run each 10th minute.

Thanks for help,

Best regards,

Leave a Reply

Your email address will not be published. Required fields are marked *