Can VBScript determine the most recently modified (or added) file in a particular folder?
Posted
by Jimminy
on Stack Overflow
See other posts from Stack Overflow
or by Jimminy
Published on 2010-03-15T21:29:02Z
Indexed on
2010/03/15
21:29 UTC
Read the original article
Hit count: 181
Hello,
I have a script (or more accurately WILL have a script) that checks a folder and copies a file from this folder to a different location (will run once per day). The fileName that I'd like to copy from, however, changes based on the date.
Basically, instead of setting the "strFilePath" to "C:\somePath\somePath2\myFile.txt" I would like to simply take the most recently modified (or added - does this make a difference in terms of the script??) in the "somePath2" folder and copy it to the destination.
Bonus (but not completely necessary) would be to check in the script if the file was modified/added in the last 24 hours and only copy it over in that case.
Thanks for your help!
© Stack Overflow or respective owner