Stuck on returning path

Results 1 to 2 of 2

Thread: Stuck on returning path

  1. #1
    Join Date
    Dec 1969

    Default Stuck on returning path

    ok, I&#039;ve been on this board a million times in the last few days i know,, but i&#039;m just stuck on this one small thing..<BR>I&#039;ve made a script to search a given folder and it&#039;s sub folders ( there are about 10,000 of them ) for files that are older then one year so i can delete them. now i only have one problem left.<BR>and thats returned the path to the files that are older then one year,, i *can find them, just can&#039;t get the local system path to where they are..<BR><BR>here is my script so far:<BR><BR><BR>Const STARTAT = "c:/imaildata"<BR>content = "c:/imaildata"<BR><BR>if Day(now()) &#060; "9" then<BR>d = Month(now())&"0"&Day(now())<BR>else<BR>d = Month(now())&""&Day(now())<BR>end if<BR><BR>Dim WshShell<BR>Set WshShell = WScript.CreateObject("WScript.Shell")<BR><BR>&#039 ;--------ADD NEW LOG FILE IF ONE DOES NOT ALREADY EXIST--------<BR><BR> Set objFSO = CreateObject("Scripting.FileSystemObject")<BR><BR> If objFSO.FileExists(""&content&"/old/"&d&".txt") Then<BR>&#039;-do nothing<BR>else<BR> Set objTS = objFSO.CreateTextFile(""&content&"/old/"&d&".txt")<BR>objTS.WriteLine("LIST OF EMAIL ADDRESSES TO BE DELETED - "&now()&"")<BR>objTS.WriteLine("-------------------------------------------------------------")<BR>end if<BR><BR> &#039;objTS.Close<BR> Set objTS = Nothing<BR> Set objFSO = Nothing<BR>&#039;-------------------------------<BR><BR>Sub OneDir( dir, indent )<BR> Dim subdir, fil<BR> &#039;Response.Write indent & "&#060;B&#062;" & dir.Name & "&#060;/B&#062;&#060;br/&#062;"<BR> For Each subdir In dir.SubFolders<BR> OneDir subdir, indent & "-- "<BR> Next<BR> For Each fil In dir.Files<BR><BR> if right(, 3) = ".in" then<BR><BR>IF DateDiff("YYYY", fil.DateLastModified, Date) &#062; 1 Then<BR>&#039;--------ADD NEW LINE IF FILE IS OLDER THEN 1 YEAR--------<BR>Const fsoForAppend = 8<BR><BR>Dim objFSO<BR>Set objFSO = CreateObject("Scripting.FileSystemObject")<BR>Dim objTextStream<BR>Set objTextStream = objFSO.OpenTextFile(""&content&"/old/"&d&".txt", fsoForAppend)<BR>objTextStream.WriteLine FSO.GetAbsolutePathName(dir.Files)&"\"&dir.Name&" - "&fil.DateLastModified<BR>objTextStream.Close<BR>S et objTextStream = Nothing<BR>Set objFSO = Nothing<BR>&#039;-----------------------------<BR>end if<BR><BR> end if<BR> Next<BR>End Sub<BR><BR>Set FSO = CreateObject("Scripting.FileSystemObject")<BR>Set startDir = FSO.GetFolder(STARTAT)<BR><BR>OneDir startDir, ""<BR><BR>and this seems to be the problem line:<BR>objTextStream.WriteLine FSO.GetAbsolutePathName("\"&dir.Name&" - "&fil.DateLastModified<BR><BR>i&#039;ve tryed severl different ways to get this path, but just can&#039;t get it to work. here is what is produces:<BR><BR><BR>C:imaildataaliceonaliceon - 12/04/2001 6:15:32 PM<BR>but should be<BR>C:imaildatawww.domain.comuseraliceonaliceon - 12/04/2001 6:15:32 PM<BR><BR>any ideas as to what i&#039;m doing wrong here? and how i can fix it?<BR><BR>thanks again for your time.<BR>ken<BR>

  2. #2
    Join Date
    Dec 1969

    Default I told you...

    ...that GetAbsolutePathName is *WORTHLESS*.<BR><BR>Why are you using it?<BR><BR>I&#039;m not sure exactly what file it is you are trying to get the full path of. If it&#039;s the "fil" file in this code:<BR> For Each fil In dir.Files<BR> if right(, 3) = ".in" then<BR> ... you want absolute path to fil??? ...<BR><BR>then it is dirt easy:<BR><BR><BR>Need I say more? The DOCS are your FRIENDS. Visit them often.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts