Date: Wed, 14 Apr 2010 20:52:38 -0500
Reply-To: "Data _null_;" <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Data _null_;" <iebupdte@GMAIL.COM>
Subject: Re: Get external file last modified date and time regardless of
Content-Type: text/plain; charset=ISO-8859-1
Maybe Mr. DeVenezia's example will provide a more direct route to the
data you seek and relieve the burden of regional setting.
On 4/14/10, Scott Bass <firstname.lastname@example.org> wrote:
> This is more a Windows question, but here goes...
> I need to get a directory list, including the last modification date ***in a
> format independent of the regional settings***.
> For example, my regional settings for date is dd-MMM-yy and time is HH:mm:ss
> (24 hour time).
> So a sample directory list is:
> Directory of c:\temp
> 25-Mar-10 13:22 100 temp.sas
> which is likely different than your machine, esp. if you're in the US.
> I need the last modified date/time of the file, and have confidence that my
> code will get the correct results no matter the regional setting of the end
> users machine.
> I'm aware of the anydt* formats - perhaps these will work? But I'd have to
> try them with every combination of regional date settings. And while the
> date settings are pre-populated with a dropdown list, it looks like I can
> overtype them to set my own settings.
> Alternatively, are there any undocumented switches to dir that would format
> the date/time of files consistently?
> Finally, if any birdies are listening, here is a modified code snippet
> straight from the FINFO function:
> data info;
> length infoname infoval $60;
> drop rc fid infonum i close;
> do i=1 to infonum;
> This gives me the oh-so-unhelpful list of filename, recfm, and lrecl. C'mon
> SAS, you're up to v9.2. How about a few more external file attributes so I
> can get this information portably, without exiting to the O/S?
> Here would be a good list to start with:
> In addition, substitution of FOR variable references has been enhanced.
> You can now use the following optional syntax:
> %~I - expands %I removing any surrounding quotes (")
> %~fI - expands %I to a fully qualified path name
> %~dI - expands %I to a drive letter only
> %~pI - expands %I to a path only
> %~nI - expands %I to a file name only
> %~xI - expands %I to a file extension only
> %~sI - expanded path contains short names only
> %~aI - expands %I to file attributes of file
> %~tI - expands %I to date/time of file
> %~zI - expands %I to size of file
> %~$PATH:I - searches the directories listed in the PATH
> environment variable and expands %I to the
> fully qualified name of the first one found.
> If the environment variable name is not
> defined or the file is not found by the
> search, then this modifier expands to the
> empty string
> The modifiers can be combined to get compound results:
> %~dpI - expands %I to a drive letter and path only
> %~nxI - expands %I to a file name and extension only
> %~fsI - expands %I to a full path name with short names only
> %~dp$PATH:I - searches the directories listed in the PATH
> environment variable for %I and expands to the
> drive letter and path of the first one found.
> %~ftzaI - expands %I to a DIR like output line
> Thanks for any ideas you can provide...