Computing.Net > Forums > Programming > retrieving DOS file date

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

retrieving DOS file date

Reply to Message Icon

Name: hammerdilk
Date: February 7, 2005 at 12:00:25 Pacific
OS: DOS
CPU/Ram: Pentium 4 / 2 GB RAM
Comment:

How do I use simple DOS commands (trying to create a batch script) to get the date from a file in the directory? I have looked, and there does not appear to be any DOS commands that will retrieve this.

Any help?



Sponsored Link
Ads by Google

Response Number 1
Name: dtech10
Date: February 7, 2005 at 14:14:55 Pacific
Reply:

Hi hammer
What version DOS are you using and do you want the file date into a environment variable or just displayed on the screen.


0

Response Number 2
Name: hammerdilk
Date: February 7, 2005 at 14:19:02 Pacific
Reply:

dtech10,

Thanks for the response...actually, it is Windows 2000, so DOS version 5.0. I would like to get this into a variable as I need to compare this to the current date so that we can determine if we have received a new version of the file or if our tasks are still processing off of an older version.


0

Response Number 3
Name: dtech10
Date: February 7, 2005 at 15:44:45 Pacific
Reply:

Hi hammer
I not familar with Win2000 ,but this works in WinXP Pro.

@echo off
dir program.ext | find /i "program.ext" > dir.txt
for /f "tokens=1 delims= " %%a in (dir.txt) do set XDate="%%a


0

Response Number 4
Name: dtech10
Date: February 7, 2005 at 15:48:48 Pacific
Reply:

Hi
XDate="%%a
Just delete the "


0

Response Number 5
Name: Mechanix2Go
Date: February 7, 2005 at 20:12:38 Pacific
Reply:

A quick cruise through:

for /?

shows that resolvong file to date/time is built in.

M2


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: retrieving DOS file date

Compare a file date with my hardcoded date www.computing.net/answers/programming/compare-a-file-date-with-my-hardcoded-date/19618.html

Old dos file www.computing.net/answers/programming/old-dos-file/725.html

copying files dated today w/o overwrite www.computing.net/answers/programming/copying-files-dated-today-wo-overwrite/18922.html