Directory "file dates" keep changing (for DIR) - Win 10

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
MicrosoftIsKillingMe
Posts: 41
Joined: 11 Dec 2017 09:08

Directory "file dates" keep changing (for DIR) - Win 10

#1 Post by MicrosoftIsKillingMe » 24 Mar 2019 11:19

Win 10 keeps touching the date of folders which miserably causes directory c:\foo to appear out of order at the end of
dir /OD
even though I created it long ago, earlier than other files that display above it for that command.

Maybe this has to do with accessed date vs. modified date. (Note that in Windows Explorer you will probably want to view "modified date" instead of "date" - those MS programmer dumbasses!). Well totally duh, I want modified date in DOS too - like it worked for ages and ages (at least through XP, and almost always on Win 7 except for some system dirs).

While "yet again" growling at how possibly could MS have gotten that so cluelessly wrong, got any solutions? It feels like I'm wanting to modify the behavior of DIR, but perhaps there's a system setting to stop the nonsense in the first place? Maybe something in the registry vicinity of NtfsDisable8dot3NameCreation (which BTW I visit frequently because something keeps turning it on).

penpen
Expert
Posts: 1675
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Directory "file dates" keep changing (for DIR) - Win 10

#2 Post by penpen » 24 Mar 2019 11:28

Maybe you could use some command line argument of the "dir"-command, such like "/T".


penpen

MicrosoftIsKillingMe
Posts: 41
Joined: 11 Dec 2017 09:08

Re: Directory "file dates" keep changing (for DIR) - Win 10

#3 Post by MicrosoftIsKillingMe » 24 Mar 2019 12:23

Excellent idea ... /TW ... but it seems that the OS is actually modifying the modified dates themselves, as /TW doesn't help. I really appreciate the suggestion though.

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

Re: Directory "file dates" keep changing (for DIR) - Win 10

#4 Post by Squashman » 24 Mar 2019 13:32

Sounds like a wild goose chase to me. There is no way for us to tell you what is modifying the files.

MicrosoftIsKillingMe
Posts: 41
Joined: 11 Dec 2017 09:08

Re: Directory "file dates" keep changing (for DIR) - Win 10

#5 Post by MicrosoftIsKillingMe » 24 Mar 2019 15:22

Re wild goose - thanks for the frank assessment. It's possible that a specific software is touching the dates but in terms of my overt operations I'm not doing anything that I haven't been doing forever; and this is just appearing in Windows 10. Well, 98% the same; I am running one new piece of financial software with the culprit dirs, but otherwise the only things new from the past are this OS and Office 365 (vs. Office 2007 and 2003 and97). Maybe it's something in the background - antivirus or backup agent or some other wild goose. I certainly haven't removed or moved or created these directories after the first day creating them so it's not User 001 error :( I do once in a while MD \scratch\ and later RD that; I hope it's not something ridiculous like that.

I'll try to isolate a common denominator, whether it's opening Explorer or doing xcopy or doing save-as from emails or whatever peculiar thing that might be triggering it. BTW this is referring to directories I made with MD. This isn't referring to \Program Files, \ProgramData, \Windows and other system directories whose modified date routinely increases despite me not installing anything or so forth. That's what led me to suspect the OS to begin with.

Meanwhile if I don't hear that anyone else sees this happening on their user-created dirs, I'll really do some extremely tedious self-examination (checking the date every 15 seconds all day long to isolate it :evil: )

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

Re: Directory "file dates" keep changing (for DIR) - Win 10

#6 Post by Squashman » 24 Mar 2019 16:53

MicrosoftIsKillingMe wrote:
24 Mar 2019 15:22
I do once in a while MD \scratch\ and later RD that; I hope it's not something ridiculous like that.
Anything you do inside a directory will change it's modified time. That would include making and deleting folders. Creating Files. Deleting Files.

MicrosoftIsKillingMe
Posts: 41
Joined: 11 Dec 2017 09:08

Re: Directory "file dates" keep changing (for DIR) - Win 10

#7 Post by MicrosoftIsKillingMe » 24 Mar 2019 17:12

Son of a BITCH! MD and RD within a dir DOES change the dir's date. That is so ridiculous.
c:\foo has existed for a month;
DIR C:\FOO*.*
01/23/2019 10:17 AM <DIR> FOO

cd \foo
md scratch
rd scratch

and now, dammit,
DIR C:\FOO*.*
03/24/2019 6:08 PM <DIR> FOO

You're dead right. But creating and deleting files within a DIR? Seriously??

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

Re: Directory "file dates" keep changing (for DIR) - Win 10

#8 Post by Squashman » 24 Mar 2019 18:12

I really don't see how you think this is so shocking. You are making a change to the file system. Any file system is going to do this. This isn't just a Microsoft thing.

MicrosoftIsKillingMe
Posts: 41
Joined: 11 Dec 2017 09:08

Re: Directory "file dates" keep changing (for DIR) - Win 10

#9 Post by MicrosoftIsKillingMe » 24 Mar 2019 18:53

Think of the basic FAT and file system architecture. If I add a file A.TXT to c:\foo, nothing in the file system need change for FOO entries (at least, never needed to until "last accessed" came into being). A file entry for A.TXT with that creation date is created; but that alone would be no reason to touch the FOO file date, from a file system standpoint (although "last accessed" might be touched). I understand the counter logic though, claiming that you "modified" \FOO\; I just don't like it.

Now I'm just ranting. I appreciate your skilled identification of the reason for the date change. And I certainly overshot originally in my accusation or implication that DIR was reporting something other than modified date. It does report modified date. It turns out that I'm just pissed that the date was modified at all.

SS64
Posts: 1
Joined: 30 Mar 2019 10:46

Re: Directory "file dates" keep changing (for DIR) - Win 10

#10 Post by SS64 » 30 Mar 2019 10:49

There is some logic to the file system working this way, but you can also reset the folder date with some PowerShell
https://ss64.com/ps/syntax-lastmodified.html

Post Reply