[AccessD] OT: DOS COMMAND

dave sharpe davesharpe2 at cox.net
Tue Mar 18 17:03:59 CST 2003


Rich

I don't think that DOS alone will do what you need.
The following should work within an Access Module to
do what you're looking for.

Dave

==================================
Option Compare Database

Function DelByDate()
Dim TheFileDate As Date
Dim theFile As String
Dim HowOld As Integer

ChDrive ("C:")              'set to meet your needs
ChDir "C:\Temp"             'set to meet your needs

theFile = Dir("*.*")

Do While theFile <> ""
TheFileDate = FileDateTime(theFile)
HowOld = DateDiff("d", TheFileDate, Date)

If HowOld > 5 Then
Debug.Print theFile, HowOld, TheFileDate
'Kill (theFile)
End If

theFile = Dir()
Loop

End Function

  ----- Original Message ----- 
  From: Lavsa, Rich 
  To: 'accessd at databaseadvisors.com' 
  Sent: Tuesday, March 18, 2003 2:13 PM
  Subject: [AccessD] OT: DOS COMMAND


  Hello all,

  I know this has nothing to do with Access however I am trying to spark my
  brain back to the early 90's.  I am trying to write a DEL statement that
  will go and delete files in a certain directory that are older then 5 days.

  I can't remember if there were switches and/or [attributes] that you could
  use in a single command line or if you had to write a Batch file to do this.


  Again I apologize for this OT, but I'm positive some of you know this
  stuff!!

  Rich
  _______________________________________________
  AccessD mailing list
  AccessD at databaseadvisors.com
  http://databaseadvisors.com/mailman/listinfo/accessd
  Website: http://www.databaseadvisors.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030318/1e22bb86/attachment-0001.html>


More information about the AccessD mailing list