4NT Tips

revised 16 Sep 2005

Copyright © 2005 Stan Brown, Oak Road Systems

Contents: 

Sort Directory Entries to Match Filenames

This is a non-issue in an NTFS file system, but under FAT32 a wildcard search will return filenames in the order of their physical entries in the directory, not necessarily in alphabetical order. There doesn't seem to be a reliable directory sorter, but Steve Fábián provided a script in a comp.os.msdos.4dos article (QvWdnY_QIdVT6gnfRVn-1g@comcast.com, 2005-05-25):

REN ...\MYDIR\ \RENAME.DIR\ 
MD /S ...\MYDIR
DIR/B/ONE/A-D ...\RENAME.DIR | FOR %f IN (@CON) REN %f ...\MYDIR\

(August 2005)

Find Most Recent File

Sort a directory listing in reverse by date, and grab the first line with @EXECSTR:

set latest=%@execstr[dir /a-d /o-d /b *.bas]

source: Charles Dye, "Re: Newest file matching a criterion?" in comp.os.msdos.4dos (mtfnd1heb94fvqmgjlepanra8rtu2a33d7@4ax.com, 2005-07-18)

(September 2005)

What's New