search for files created today

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Courage
Newbie
Posts: 10
Joined: Thu Jul 12, 2007 4:54 pm

search for files created today

Post by Courage » Fri Jun 04, 2010 12:38 am

Hi: can somebody assist me in this one?
How can I made an automated macro to search for files created TODAY on certain Windows Network folder shares? ie: \\servername\share$

thanks

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

get list of files created today

Post by adroege » Fri Jun 04, 2010 1:11 am

There are at least a couple of ways to do this..... Here is one way

[code]
//mydir can be in UNC or regular windows folder format
Let>mydir=\\127.0.0.1\C
//Let>mydir=C:\temp\

Day>dd
Month>mm
Year>yyyy

Let>mydate=%mm%/%dd%/%yyyy%

Let>RP_WAIT=1

//If you want to search subdirectories also add the /s parameter
//Run>cmd /c dir %mydir% /s | find "%mydate%" >%TEMP_DIR%\temp_file_list.txt

Run>cmd /c dir %mydir% | find "%mydate%" >%TEMP_DIR%\temp_file_list.txt
ReadFile>%TEMP_DIR%\temp_file_list.txt,filelist
MessageModal>filelist
[/code]
Last edited by adroege on Fri Jun 04, 2010 2:22 am, edited 3 times in total.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

GetFileList doesn't do UNC paths

Post by adroege » Fri Jun 04, 2010 2:11 am

Here is another method, but it doesn't work with UNC paths, so using the DOS dir command seems like it's the better method.

[code]
Day>dd
Month>mm
Year>yyyy
Let>Today=%yyyy%%mm%%dd%
Let>file_list=

//This method doesn't work with UNC paths
//Let>mydir=\\127.0.0.1\C
Let>mydir=C:\*.*

GetFileList>mydir,files
Separate>files,;,file_names
If>file_names_count>0
Let>k=0
Repeat>k
Let>k=k+1
FileDate>file_names_%k%,dFileDate
Let>today_file=file_names_%k%
If>dFileDate=%Today%
ConCat>file_list,%today_file% %CRLF%
Endif
Until>k,file_names_count
Endif

MessageModal>file_list

[/code]

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts