check if file exist

Results 1 to 2 of 2

Thread: check if file exist

  1. #1
    Join Date
    Dec 1969

    Default check if file exist

    how do i check if the file exist inside a folder before i can delete it..???<BR><BR>Here is the code i have that deletes the file.<BR><BR>Path = Rs("Sub_Image")<BR><BR>arrayPath=split(Path,"/") <BR>image_name=arrayPath(UBound(arrayPath)) <BR>folder ="D:clientspitacsWork Areaaspimagesproduct_images\"<BR>fullpath=folder&i mage_name<BR><BR>Set fs = CreateObject("Scripting.FileSystemObject")<BR>Set file = fs.GetFile(fullpath)<BR>file.Delete

  2. #2
    Eddie Campbell Guest

    Default RE: check if file exist

    FSO provides a FileExits method. Read the help in the Vbscript Reference link on the left of this page.<BR><BR>Set fs = CreateObject("Scripting.FileSystemObject")<BR>If fs.FileExists(fullpath) then<BR> Set file = fs.GetFile(fullpath)<BR> file.Delete<BR>End If

Posting Permissions

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