What is the name of the newest file?
This scripts selects the file in a path that was updated/created today. This is ideal for selecting today's log file from an application, when you don't know the name of the log file (it's randomly created). The only things you do know is that it's daily and has a certain extension.
So now you can work with that log file going forward using another script.
Find Newest (Log?) File in a Directory has no reviews.
Does this script look only at the parent directory or would it look at subdirectories in the parent directories
Hi Buster Davis, this script in it's current state, would only work on the parent directory and not it's subdirectories.
Changing it to have it look through subdirectories as well is easy actually:
1. Open the Agent Procedure for editing
2. Click on line 15, this currently says "dir #global:SearchPath##global:SearchFile# /a-d /o-d /tw|findstr /C:"%date:~-10%">>#awd#\NewestFile\FileList.txt"
3. change that line to say "dir #global:SearchPath##global:SearchFile# /s /a-d /o-d /tw|findstr /C:"%date:~-10%">>#awd#\NewestFile\FileList.txt"
4. Save the Agent Procendure and Run that on a test machine that you know has that file type in at least one subdirectory of the chosen search path.
Let me now how you're getting along with that!?