|
| Hi Folks,
I'm trying to delete 2 files using filesystemobject. The mail file name is
stored in an
access db.
using the code below I can delete the main file but not the thumbnail.
The thumbnail has the same file name plus the suffix "_small" so if the main
file
is called "mypicture.jpg" the thumbnail is called "mypicture_small.jpg"
The main file is being deleted but no matter how I try I cannot get the
thumbnail
deleted. They are both in the same folder with the same permissions.
Can anyone shed any light on why this doesn't work?
Dan
Dim Photo, PhotoSmall
Photo= Rs_photo.Fields.Item("Photo_name").Value
PhotoSmall = Left(Photo, Len(Photo)-4)
PhotoSmall = PhotoSmall & "_small" & Right(Photo,4)
Set File = CreateObject("Scripting.FileSystemObject")
ImagePath = Server.MapPath("..\images\M_photos")
ImagePath2 = Server.MapPath("..\images\M_photos")
ImagePath = ImagePath & "\" & Photo
ImagePath2 = ImagePath & "\" & PhotoSmall
' check if file exists and if true delete the file
If fileExists(ImagePath) Then
File.DeleteFile(ImagePath)
End if
If fileExists(ImagePath2) Then
File.DeleteFile(ImagePath2)
End if
|
|