Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



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
 
 
Register now for full access!
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
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
what kind of errors it is generating?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
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.87452 seconds with 12 queries