PC Review


Reply
Thread Tools Rate Thread

dir command with File Access

 
 
Dave
Guest
Posts: n/a
 
      25th Jul 2005
Hello all, I hope someone can help me.

How can I list a file's File Access date? Even better, how can I get a
listing of files with an access date later than a given date?

Thanks,

Dave


 
Reply With Quote
 
 
 
 
David Candy
Guest
Posts: n/a
 
      25th Jul 2005
Did you type dir in Help?

--
--------------------------------------------------------------------------------------------------
http://webdiary.smh.com.au/archives/...nt/001075.html
=================================================
"Dave" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> Hello all, I hope someone can help me.
>
> How can I list a file's File Access date? Even better, how can I get a
> listing of files with an access date later than a given date?
>
> Thanks,
>
> Dave
>
>

 
Reply With Quote
 
Marty List
Guest
Posts: n/a
 
      26th Jul 2005

You could use the "DIR /TA" command, or "DIR /TA /A-D" if you want files
only, folders excluded. A simple batch file would look like this:

(Note: Remove the line numbers, use them to identify unwanted line
wraps)

1. @Echo Off
2. SetLocal ENABLEEXTENSIONS
3. Set TARGETFOLDER=%TEMP%
4. Set MINIMUMDATE=07/15/2005
5. For /F %%A In ('Dir "%TARGETFOLDER%" /N /TA /A-D^|Find "/"') Do @If %%A
GTR %MINIMUMDATE% Echo %%A



"Dave" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello all, I hope someone can help me.
>
> How can I list a file's File Access date? Even better, how can I get a
> listing of files with an access date later than a given date?
>
> Thanks,
>
> Dave
>



 
Reply With Quote
 
Marty List
Guest
Posts: n/a
 
      26th Jul 2005

Ignore the last post, I forgot to re-arrange the date elements so they sort
correctly (i.e.: 07/01/2005 needs to be converted to 2005/07/01).

01. @Echo Off
02. SetLocal ENABLEEXTENSIONS
03. Set TARGETFOLDER=%TEMP%
04. Set MINIMUMDATE=07/22/2005
05.
06. For /F %%A In ('Dir "%TARGETFOLDER%" /ta /a-d^|Find "/"') Do @Call
:CheckDate %%A %MINIMUMDATE%
07. GoTo :EOF
08.
09. :CheckDate
10. Set DATE1=%1
11. For /F "tokens=1-3 delims=/" %%A In ('Echo %DATE1%') Do @Set
DATE1=%%C/%%A/%%B
12. Set DATE2=%2
13. For /F "tokens=1-3 delims=/" %%A In ('Echo %DATE2%') Do @Set
DATE2=%%C/%%A/%%B
14. If %DATE1% GTR %DATE2% Echo %DATE1%
15. GoTo :EOF



"Marty List" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> You could use the "DIR /TA" command, or "DIR /TA /A-D" if you want files
> only, folders excluded. A simple batch file would look like this:
>
> (Note: Remove the line numbers, use them to identify unwanted line
> wraps)
>
> 1. @Echo Off
> 2. SetLocal ENABLEEXTENSIONS
> 3. Set TARGETFOLDER=%TEMP%
> 4. Set MINIMUMDATE=07/15/2005
> 5. For /F %%A In ('Dir "%TARGETFOLDER%" /N /TA /A-D^|Find "/"') Do @If %%A
> GTR %MINIMUMDATE% Echo %%A
>
>
>
> "Dave" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Hello all, I hope someone can help me.
>>
>> How can I list a file's File Access date? Even better, how can I get a
>> listing of files with an access date later than a given date?
>>
>> Thanks,
>>
>> Dave
>>

>
>



 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      26th Jul 2005
On Mon, 25 Jul 2005 14:24:52 -0500, "Dave"
<(E-Mail Removed)> wrote in
microsoft.public.win2000.cmdprompt.admin:

>Hello all, I hope someone can help me.
>
>How can I list a file's File Access date? Even better, how can I get a
>listing of files with an access date later than a given date?


In 4NT, this will show files with an Access Date on or after 22-Jul-2005
(/[da2005/07/22]) and display that Access Date (/T:a):

DIR /[da2005/07/22] /T:a

4NT's Date Ranges are documented at
<http://jpsoft.com/help/dateranges.htm>. 4NT is a commercial product. I
suspect that a solution for CMD.EXE is a bit more elaborate.

Also, keep in mind that the recording of Access Date can easily be
turned off (NtfsDisableLastAccessUpdate), and is only available on NTFS
drives.
Also, keep in mind that Access Date is only available on NTFS drives,
and even there can easily be turned off (NtfsDisableLastAccessUpdate),
so don't rely on it.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
Dave
Guest
Posts: n/a
 
      26th Jul 2005
Marty, Michael,

That is great information - thank you very much.

Dave




"Dave" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hello all, I hope someone can help me.
>
> How can I list a file's File Access date? Even better, how can I get a
> listing of files with an access date later than a given date?
>
> Thanks,
>
> Dave
>



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      27th Jul 2005
In microsoft.public.win2000.cmdprompt.admin Marty List wrote:

>
> Ignore the last post, I forgot to re-arrange the date elements
> so they sort correctly (i.e.: 07/01/2005 needs to be converted
> to 2005/07/01).
>
> 01. @Echo Off
> 02. SetLocal ENABLEEXTENSIONS


Suggest that adding
set DIRCMD=
may be wise. Expecially if the local CMD environment is or may be
unknown.

[ ]
 
Reply With Quote
 
Marty List
Guest
Posts: n/a
 
      27th Jul 2005

"Mark V" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In microsoft.public.win2000.cmdprompt.admin Marty List wrote:
>
>
> Suggest that adding
> set DIRCMD=
> may be wise. Expecially if the local CMD environment is or may be
> unknown.
>
> [ ]



That's a good idea. That's why I added /N to the DIR command, but resetting
DIRCMD would be more thorough.



 
Reply With Quote
 
Mark V
Guest
Posts: n/a
 
      27th Jul 2005
In microsoft.public.win2000.cmdprompt.admin Marty List wrote:

>
> "Mark V" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> In microsoft.public.win2000.cmdprompt.admin Marty List wrote:
>>
>>
>> Suggest that adding
>> set DIRCMD=
>> may be wise. Expecially if the local CMD environment is or may
>> be unknown.
>>
>> [ ]

>
>
> That's a good idea. That's why I added /N to the DIR command,
> but resetting DIRCMD would be more thorough.


Yep. I got bitten a few times with portable batch and now include
SETLOCAL
SET DIRCMD=
SET COPYCMD=
routinely to "eliminate the variables" (figuratively and
literally). :-)
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove access of a file with command prompt Vijay Windows XP General 15 5th Jan 2010 10:45 PM
can I run an exe. file from a command button in access? JIXPIX Microsoft Access Getting Started 5 16th Feb 2009 02:41 PM
Importing a CSV file into Access from Command Line Karen Middleton Microsoft Access External Data 7 4th Oct 2004 09:02 PM
Command line - File access date VDF Microsoft Windows 2000 CMD Promt 4 14th Jul 2004 12:39 AM
Using open file command in MS Access Form =?Utf-8?B?a25vd3NncmFjZQ==?= Microsoft Access Form Coding 3 11th Mar 2004 07:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:13 PM.