Date modified not updated after copying?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sam14189
Posts: 31
Joined: 22 Jan 2015 02:57

Date modified not updated after copying?

#1 Post by sam14189 » 27 Jan 2015 04:25

Hi All,
I am performing copy operation in batch script (Windows 7 32 bit operating system) but date modified is not updated. For e.g. - If file creation date is 26th April 2010 then after copy command still the date modified is showing as 26th April 2010 whereas it should be today's date because that is when copy function was executed. I googled it and i found that there is another parameter - "Date Created" which shows correct date. But i want "Date modified" to be updated to reflect time when copy was done.
Can anyone please help?

pieh-ejdsch
Posts: 257
Joined: 04 Mar 2014 11:14
Location: germany

Re: Date modified not updated after copying?

#2 Post by pieh-ejdsch » 27 Jan 2015 06:46

hallo,

you can use an empty file before copy

Code: Select all

for %i in (source) do type nul>target\%i  && copy /y %i target


Phil

sam14189
Posts: 31
Joined: 22 Jan 2015 02:57

Re: Date modified not updated after copying?

#3 Post by sam14189 » 27 Jan 2015 07:40

Well thanks! I got better solution:
copy filename.txt /B+ ,,/Y

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Date modified not updated after copying?

#4 Post by Squashman » 27 Jan 2015 07:45

sam14189 wrote:Well thanks! I got better solution:
copy filename.txt /B+ ,,/Y

Yep. That code has been posted before and linked to Microsoft's KB article.
http://support.microsoft.com/kb/69581

Post Reply