This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > July 2004 > Help with deleting thumbnails with fso





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help with deleting thumbnails with fso
Me

2004-07-31, 7:14 pm

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


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews