Return a file's date

Hi,

Is there a way to return the date a file was last created/modified on a Windows file system? The following is not working…

Q: If not exists file “C:\Test.txt” then error “no file” else date of file "C:\Test.txt"
E: The operator “date” is not defined.

Thanks

Try this instead:

Q: If not exists file "C:\Test.txt" then error "no file" else modification time of file "C:\Test.txt"

2 Likes

Or if you don’t want to bother with if/then:

modification times of files "C:\Test.txt"

(Look at all us UPenn folk on the forum!)

2 Likes

Thanks wilsonchang, alinder

1 Like

This is my preferred approach:

This is more efficient than the if/then/else options because it only has to get the file once, not twice.