Batch to list file contents but sort newest first

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Hooby1
Posts: 17
Joined: 27 Sep 2020 08:28

Batch to list file contents but sort newest first

#1 Post by Hooby1 » 12 Oct 2020 04:13

Is it possible to have a script that when executed, will export the file contents of a folder to a text file but show the exported results with the newest files (date modified) first?

T3RRY
Posts: 83
Joined: 06 May 2020 10:14

Re: Batch to list file contents but sort newest first

#2 Post by T3RRY » 12 Oct 2020 05:36

yes, its possible. read the output of dir /? for usage information regarding the switches needed to sort as per your need.

Hooby1
Posts: 17
Joined: 27 Sep 2020 08:28

Re: Batch to list file contents but sort newest first

#3 Post by Hooby1 » 12 Oct 2020 07:49

Many thanks. I was after something along the line of:

dir /b /W /O-D > updates.txt

and this works great!

Post Reply