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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File deletion/search/upload in a directory?

Status
Not open for further replies.

krish1980

Programmer
Feb 27, 2002
20
US
Dear friends,
I am using a vbscript component to upload files into a specific directory in our site. I need to provide a provision for the users to upload files. At that point I would like to search if file already exists in the same name. Similarly, as an admin there should be a provision to delete the files by providing a delete button from a list.

Right now uploading a file is over. If u could help me out in searching if the file exists,as well as deleting them it would be great.
Thanks,
krish
krish1980@rediffmail.com Krishnamoorthy
krish1980@rediffmail.com
 
Hi

To check to see if a file exists use this snippet:

Code:
set fso = Wscript.CreateObject("Scripting.FileSystemObject")
If fso.FileExist("path to your file") then
   ' do what you like
End if

' and to delete a file
fso.DeleteFile "path to your file"
Derren
[Mediocre talent - spread really thin]
 
Dear Mr.Derren,

Thanks for ur help though i used the file system object instead of the scripting object.

Thanks once again,
s.krish Krishnamoorthy
krish1980@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top