Below this is my code but when ever i want to remove directory from Rmdir NewPath$ this code it gives error Path/file access error
so what can i do for this error and how can i remove directory from my path.
On Error Goto errH
Dim S As New NotesSession
Set DB = S.CurrentDatabase
Set View = DB.GetView("AppStatus")
Set FView = DB.GetView("FMapping")
Set FDoc = FView.GetFirstDocument
Set nam=s.CreateName(Db.Server)
ServerName$=nam.Common
Set cDate = New NotesDateTime(Now)
dStr$ = Format(cDate.DateOnly, "ddmmyy")
tStr$ = Format(cDate.TimeOnly, "hhmmss")
'code for moving file in newely created folder
If view.allentries.count > 0 Then
Set TempDoc = db.CreateDocument
TempDoc.Form= "File Attachment"
For i=1 To 50
Set item=Fdoc.GetFirstItem("ServerName_"+(Cstr(i)))
Set ItemDep=Fdoc.GetFirstItem("Deploy_"+(Cstr(i)))
Set nam=s.CreateName(item.values(0))
Dep$=ItemDep.Values(0)
ServerName1$=nam.Common
If (ServerName1$=ServerName$) And Dep$<>"Yes" Then
Set item=Fdoc.GetFirstItem("FolderPath_"+(Cstr(i)))
Path$=item.values(0)
If Path$<>"" Then
fileName$ = Dir$(path$ &"\", 0)
Redim Filearr(0)
m=0
Do While fileName$ <> ""
Redim Preserve Filearr(m)
Filearr(m) =path$ & "\" & fileName$
m=m+1
fileName$ = Dir$()
Loop
If filearr(0)<>""Then
Mkdir Path$ &"\" & dStr$ & "-" & tStr$
For z=0 To Ubound(Filearr)
Set rt = New NotesRichTextItem(TempDoc, "JarAttach")
Call rt.EmbedObject(EMBED_ATTACHMENT, "", filearr(z))
If ( rt.Type = RICHTEXT ) Then
Forall j In rt.EmbeddedObjects
FileName$=j.name
NewPath$=Path$ & "\" & dStr$ & "-" & tStr$
Call j.ExtractFile(NewPath$ & "\" & j.Source)
End Forall
End If
Next
If filearr(0)<>""Then
For k=0 To Ubound(Filearr)
Kill Filearr(k)
Next
End If
End If
End If
End If
Next
End If
’ end code for moving file
’ add code for Extract file in a specified folder
If view.allentries.count > 0 Then
Set Doc = View.GetFirstDocument
While Not doc Is Nothing
If Fview.allentries.count > 0 Then
Set FDoc = FView.GetFirstDocument
For i=1 To 50
Set item=Fdoc.GetFirstItem("ServerName_"+(Cstr(i)))
Set nam=s.CreateName(item.values(0))
ServerName2$=nam.Common
If ServerName2$=ServerName$ Then
Set item=Fdoc.GetFirstItem("FolderPath_"+(Cstr(i)))
Set ItemSetOff=Fdoc.GetFirstItem("Setoff_"+(Cstr(i)))
Set ItemDep=Fdoc.GetFirstItem("Deploy_"+(Cstr(i)))
Path$=item.values(0)
Setoff$=ItemSetOff.values(0)
Dep$=ItemDep.Values(0)
If Setoff$<>"Disable" Then
If Dep$<>"Yes" Then
Set rtm=doc.GetFirstItem("JarAttach")
If ( rtm.Type = RICHTEXT ) Then
Forall o In rtm.EmbeddedObjects
If ( o.Type = EMBED_ATTACHMENT ) Then
FileName$=o.name
Call o.ExtractFile(Path$ & "\" & o.Source)
End If
End Forall
End If
End If
End If
End If
Next
End If
Set TempDoc=Nothing
Set Doc= View.GetNextDocument(Doc)
Wend
For i=1 To 50
Set item=Fdoc.GetFirstItem("ServerName_"+(Cstr(i)))
Set nam=s.CreateName(item.values(0))
ServerName2$=nam.Common
If ServerName2$=ServerName$ Then
Set ItemDep=Fdoc.GetFirstItem("Deploy_"+(Cstr(i)))
Dep$=ItemDep.Values(0)
If Dep$<>"Yes" Then
Call Fdoc.ReplaceItemValue( "Deploy_"+(Cstr(i)), "Yes" )
Dim Memodoc As notesdocument
Set Memodoc = Db.CreateDocument
Dim rtitem As notesrichtextitem
Set rtitem = New NotesRichTextItem(MemoDoc,"Body")
MemoDoc.form = "Memo"
Set item1=Fdoc.GetFirstItem("MainUserNames_"+(Cstr(i)))
MainUserName$=item1.Values(0)
Set ADoc=View.GetFirstDocument
While Not ADoc Is Nothing
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText("Quos version :- " + Adoc.Version(0) +" is released on " + ServerName$ + "Server ")
Set rtm1 = Adoc.GetFirstItem( "Releasenote" )
If Not rtm1 Is Nothing Then
If Isarray(rtm1.EmbeddedObjects) Then
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText("Changes included in version " + Adoc.Version(0) +" are as follows : ")
Call rtitem.AppendDocLink(ADoc, "Click here to open the document")
End If
End If
'Call rtitem.AddNewLine( 1 )
'Call rtitem.AppendText("Quos version :- " + Adoc.Version(0) +" is released on " + ServerName$ + "Server ")
Set ADoc= View.GetNextDocument(ADoc)
Wend
MemoDoc.Sendto = MainUserName$
' MemoDoc.Copyto ="Puneet Dahiya/Tumlare"
MemoDoc.Subject="Quos Version Released Confirmation"
Call MemoDoc.Send( True )
End If
End If
Next
End If
’ end code for Extract file
Call Fdoc.ComputeWithForm( False,False)
Call Fdoc.Save(False,True)
Print "Process Completed"
Exit Sub
errH:
If Erl=52 Then
i=0
If NewPath$ <>"" Then
Redim Preserve Filearr(i)
fileName$ = Dir$(NewPath$ &"\", 0)
Filearr(i)=NewPath$ & "\" & fileName$
i=i+1
End If
If filearr(0)<>""Then
For i=0 To Ubound(Filearr)
Kill Filearr(i)
Next
End If
Rmdir NewPath$
End If