Greetings
I need to find the latest .xls file in a directory that has multiple types of
files in it.
I can get the latest file from the directory but if I try and apply a
wildcard expression to the file request I get errors.
I am using code very similar to this
http://www.mjtnet.com/forum/viewtopic.php?p=8011
How do I script for a specific file extension.
Thanks
Greg
Find Latest .xls File in a Directory
Moderators: JRL, Dorian (MJT support)
-
- Newbie
- Posts: 13
- Joined: Tue Aug 29, 2006 1:50 am
Someone will, I'm sure, jump in with a VBScript solution. But I like DOS. The variable "file_1" will contain the newest .XLS file. The variable "file_%file_count%" will contain the oldest.
Code: Select all
Let>file1=drive:\path\
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>cmd /c dir "%file1%*.xls" /o-d /b >%temp_dir%~fileList.txt
Readfile>%temp_dir%~fileList.txt,filedata
Separate>filedata,%CRLF%,file
Sub>file_count,1
MDL>The newest file is :%file_1%
-
- Newbie
- Posts: 13
- Joined: Tue Aug 29, 2006 1:50 am