Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Updating the file time and file date when using xcopy

1,035 views
Skip to first unread message

Anil Nair

unread,
Oct 11, 2013, 6:41:45 AM10/11/13
to
Hello Guys,

We have one issue when copying the file, the file time and file date is not being updated any ideas how it can be done?

here is the actual output,

C:\>dir d:\
BORLANDC 0 10 2013-09-20 17:29:32
EMX 0 10 2013-09-20 17:30:04
TC 0 10 2013-09-20 17:30:38
DOS 0 10 2013-09-20 17:31:36
DRIVER 0 10 2013-09-20 17:31:38
PATH 0 10 2013-09-20 17:31:42
AUTOEXEC.BAT 236 00 2013-09-20 17:32:02
XYCHOP.C 2289 00 2013-04-28 16:09:48
DEVEL 0 10 2013-09-26 16:26:32
KERNEL.SYS 45341 00 2006-09-03 00:10:46
COMMAND.COM 66945 00 2006-09-03 00:11:10
XCOPY.EXE 15538 00 1981-09-16 00:00:00

the date and time is not being updated.

--
Regards,
Anil Nair

Anil Nair

unread,
Oct 11, 2013, 6:47:55 AM10/11/13
to
Hello All,

>XCOPY.EXE 15538 00 1981-09-16 00:00:00

This is the particular file i copied using,
"xcopy c:\xcopy.exe d:\"

Sorry for not pinpointing my issue.

--
Regards,
Anil Nair

kerr...@w3.to

unread,
Oct 11, 2013, 6:53:09 AM10/11/13
to
On Friday, October 11, 2013 9:47:55 PM UTC+11, Anil Nair wrote:
>
> >XCOPY.EXE 15538 00 1981-09-16 00:00:00
>
> This is the particular file i copied using,
>
> "xcopy c:\xcopy.exe d:\"

The actual question is - what calls would you
expect xcopy to be making that will copy a
file, preserving attributes and date/time?

Is it INT 21h function 43 00 plus function 57 00
from the source file, and 43 01 and 57 01 on the
destination file?

Or should creatfile be used to set the attribute?

Thanks. Paul.

JJ

unread,
Oct 11, 2013, 7:15:06 AM10/11/13
to
XCOPY isn't designed to behave that way.
File copy operation is not supposed to update the timestamps of the new file
copy to current time.

XCOPY-ed subdirectories on the other hand, aren't actually copied because
under DOS, subdirectory's timestamps can't be changed. So XCOPY simply
creates new subdirectories, whose timestamps always reflects the time when
they were created.

You'll need to use a tool to mass update file timestamps.
Try Borland's TOUCH.COM.
Message has been deleted

JJ

unread,
Oct 11, 2013, 12:53:01 PM10/11/13
to
On Fri, 11 Oct 2013 04:30:39 -0700 (PDT), Anil Nair wrote:
> Here is the original dir,
>
> "
> C:\>dir d:\
> Volume in drive D is PDOS
> Volume Serial Number is 3440-17FA
>
> Directory of D:\
>
> IO SYS 11,252 10-11-13 4:29p
> MSDOS SYS 37,562 10-11-13 4:46p
> COMMAND COM 37,918 10-11-13 1:01p
> FROM <DIR> 10-11-13 4:30p
> XCOPY EXE 15,538 09-22-07 10:10a
> 1 C 32,259 00-00-80 12:00a
> 5 file(s) 134,529 bytes
> 1 dir(s) 30,625,792 bytes free
> C:\>
> "
>
> I use xcopy and then replace the file,
> "
> C:\>xcopy 1.c d:\
> Overwrite D:\1.C (Yes/No/Overwrite all/Skip all)? y
> Copying C:\1.C
> 1 file(s) copied
> C:\>dir d:
> Volume in drive D is PDOS
> Volume Serial Number is 3440-17FA
>
> Directory of D:\
>
> IO SYS 11,252 10-11-13 4:29p
> MSDOS SYS 37,562 10-11-13 4:46p
> COMMAND COM 37,918 10-11-13 1:01p
> FROM <DIR> 10-11-13 4:30p
> XCOPY EXE 15,538 09-22-07 10:10a
> 1 C 32,259 00-00-80 12:00a
> 5 file(s) 134,529 bytes
> 1 dir(s) 30,625,792 bytes free
> "

That's because the source "1.C" file date (which isn't shown) is also
"00-00-80 12:00a", or any other invalid date value. The COMMAND.COM will
show invalid dates like those above.

> Now how does freedos preserve the file time and date of the file "1.c"

Using DOS interrupt with raw timestamp value, which is in FAT timestamp
format.
You won't be able to do this if you're using getftime and setftime.

Anil Nair

unread,
Oct 11, 2013, 12:57:04 PM10/11/13
to
Hello Guys,

We figured out, xcopy uses following calls to append time stamp to file while copying from source to destination,

Int 21/AX=5700-DOS 2+ - GET FILE'S LAST-WRITTEN DATE AND TIME
"http://www.ctyme.com/intr/rb-2992.htm"
and
Int 21/AX=5701-DOS 2+ - SET FILE'S LAST-WRITTEN DATE AND TIME
"http://www.ctyme.com/intr/rb-2993.htm"

Apparently we hadn't programmed these two interrupts.

--
Regards,
Anil Nair
0 new messages