Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete images from a folder 1

Status
Not open for further replies.

waely

Programmer
Dec 7, 2003
227
US
hi,
I need some help please. when I insert a record in my access db I insert the path for the image related to this record. these images are located in "upload" folder. how can I delete these images when I delete the related records from my access.

thanks for advance for any help.
 
FSO can be used to manipulate the directory structure.


Function FSOExampleDelete()
'-- Reference Library
'-- Microsoft Scripting Runtime Libarary
Dim objFSO As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
Dim filename As String
filename = objFSO.GetFileName("C:\AEmptyDir\Test2.rpt")
Debug.Print "------- my file ---------"
Debug.Print "File Name = "; filename

If objFSO.FileExists("C:\AEmptyDir\Test2.rpt") Then
'---Delete the file.
objFSO.DeleteFile ("C:\AEmptyDir\Test2.rpt")
Else
Debug.Print "The file to delete does not exist. "; filename
End If

Set objFSO = Nothing

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top