Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attrib

Status
Not open for further replies.

figler

Programmer
Dec 26, 2001
155
US
Does anyone know how I can get the last modified' property of a file in a batch file? Attrib is the closest function I've found, but it looks like it may not provide the information I need. Thanks in advance. -Brad
 
dir /tw will show the last date/time the file was written. Marc Creviere
 
Thanks much. Is there a way I can pass a file as an argument and return a string containing the date modified (even if I have to parse to get it)? What I ultimately want to do is compare the date modified property of two files to determine if one needs to be replaced. Thanks. -b
 
Have you tried using the old DOS command of FC (file compare) and output the data to another file?
 
Yizhar... that's exactly what I needed -- thank you *so* much!

Now there are two more things that I could use some help figuring out before I write this...

1. When using xcopy, I am asked whether the destination is a file or directory. I looked at xcopy /? but didn't see a switch that would suppress that prompt and assume that destination is a file... any ideas?
2. The destination directory may not exist -- is there a way to force the directory to be created if it doesn't exist?
3. I am copying over a network -- can I use UNC (e.g., \\ServerName\ShareName\DirectoryName\FileName.mdb) or do I have to map a drive?
4. Will DOS halt execution of the batch file until the file is copied? That is, can I assume that when the file has finished running that the file has been copied?

Thanks so much everyone for the responses -- it is *much* appreciated! -Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top