Posts: 6
Name: Martin
Location: Bromsgrove, England UK
|
Hi everyone,
I've built a simple ASP page which is designed to recieve the name of a file from a form, checks if it actually exists on the server, if it does it copies it to a backup file and then deletes the original. I think I am using the correct functions although I think there is a problem with my syntax as I am fairly new to writing ASP. My code is below - can anyone give me some pointers?
Code:
<%
dim filetodelete, fs
filetodelete = request.QueryString("thefilename")
set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile ("C:\server\downloadfiles\" & filetodelete &,"C:\sorce fps\downloadfiles-backup\")
set fs=nothing
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists("C:\server\downloadfiles\" & filetodelete) then
fs.DeleteFile("C:\server\downloadfiles\" & filetodelete)
endif
set fs=nothing
response.write("<script type='text/javascript'>top.close();</script>")
%>
|