Reply
fs.CopyFile and fs.DeleteFile query
Old 04-16-2009, 04:59 AM fs.CopyFile and fs.DeleteFile query
Novice Talker

Posts: 6
Name: Martin
Location: Bromsgrove, England UK
Trades: 0
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>")
 
%>
zxnet2k is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 04-17-2009, 06:54 AM Re: fs.CopyFile and fs.DeleteFile query
Novice Talker

Posts: 6
Name: Martin
Location: Bromsgrove, England UK
Trades: 0
Hi all,

I've ammended the code as follows:

<%
dim filetodelete, fs
filetodelete = request.QueryString("thefilename")
Set fs=Server.CreateObject("Scripting.FileSystemObject")
if fs.FileExists ("C:\server\downloadfiles\" & filetodelete) then
fs.CopyFile ("C:\server\downloadfiles\" & filetodelete & ,"C:\sorce fps\downloadfiles-backup\")
fs.DeleteFile("C:\server\downloadfiles\" & filetodelete)
endif
set fs=nothing
response.write("<script type='text/javascript'>top.close();</script>")
%>

However it is still generating a few errors which I can't seem to resolve - can anyone have a look through and guide me as to where I am going wrong?

Thanks
zxnet2k is offline
Reply With Quote
View Public Profile
 
Old 04-27-2009, 06:37 AM Re: fs.CopyFile and fs.DeleteFile query
nayes84's Avatar
Super Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 139
Name: John
Location: Tokyo
Trades: 0
what kind of errors it is generating?
__________________
Upload Your Photos For Free | Submit Website To ePhoto Bay
ASP VS JSP
| Free Online Galleries
If I'm("Helpful") Then Add_Talkupation("nayes84") End If
nayes84 is offline
Reply With Quote
View Public Profile Visit nayes84's homepage!
 
Reply     « Reply to fs.CopyFile and fs.DeleteFile query
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11325 seconds with 13 queries