473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Deleting a Remote file placed in same network through VBScript-ASP

Hello all
I want to delete a file which is not placed on my local machine, it is placed on diffrent machine but in the same network. How can i delete that file , i am using VBScript -ASP
Thanks in advanced
Nov 15 '07 #1
9 11739
shweta123
692 Expert 512MB
Hi,

Use Filesystemobject to deal with the files.
e.g.
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.  
  3.                      Dim fso
  4.                      Dim filename
  5.                      set fso = Server.CreateObject("Scripting.FileSystemObject")
  6.  
  7.                      ''''Path of the file to be deleted
  8.                      filename = "\example.txt"   
  9.  
  10.                      '''Check if file exists before deleting
  11.  
  12.                      If fso.FileExists(filename) then
  13.                           ''''Delete the file
  14.                           fso.DeleteFile(filename)
  15.                     else
  16.                          Response.write("File does not exists")
  17.                     end if 
  18.                     set fso = nothing
  19.        %>
Hello all
I want to delete a file which is not placed on my local machine, it is placed on diffrent machine but in the same network. How can i delete that file , i am using VBScript -ASP
Thanks in advanced
Nov 15 '07 #2
Hi Shweta
Thanks For The quick Reply,i have tried your code it will run fine if my file is on the local system,but I have to delete a file which is placed on some other system but both system are in same network.
Hi,

Use Filesystemobject to deal with the files.
e.g.
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.  
  3.                      Dim fso
  4.                      Dim filename
  5.                      set fso = Server.CreateObject("Scripting.FileSystemObject")
  6.  
  7.                      ''''Path of the file to be deleted
  8.                      filename = "\example.txt"   
  9.  
  10.                      '''Check if file exists before deleting
  11.  
  12.                      If fso.FileExists(filename) then
  13.                           ''''Delete the file
  14.                           fso.DeleteFile(filename)
  15.                     else
  16.                          Response.write("File does not exists")
  17.                     end if 
  18.                     set fso = nothing
  19.        %>
Nov 15 '07 #3
shweta123
692 Expert 512MB
Hi,

If the file is located on the remote machine then give the full path of the filename.

e.g.

If the file is located on the remote machine with the name "remote-machine"
then full path will be //remote-machine/filename or if you dont know the machine name on the remote system you can also use IP address of the machine you want to access.


Hi Shweta
Thanks For The quick Reply,i have tried your code it will run fine if my file is on the local system,but I have to delete a file which is placed on some other system but both system are in same network.
Nov 15 '07 #4
I have tried with IP Address as well as Machine name but error comes like netwrok path not found,infact network path is correct. I have tried it as follow

Expand|Select|Wrap|Line Numbers
  1. Dim objFSO,filename
  2. Set objFSO = CreateObject("Scripting.FileSystemObject")
  3. objFSO.DeleteFile "\\\\192.168.2.241\\c:\\test.txt",true
  4.  
But i got error like Network Path was not found same in the case of Machine name

Hi,

If the file is located on the remote machine then give the full path of the filename.

e.g.

If the file is located on the remote machine with the name "remote-machine"
then full path will be //remote-machine/filename or if you dont know the machine name on the remote system you can also use IP address of the machine you want to access.
Nov 16 '07 #5
shweta123
692 Expert 512MB
Hi,

Try to give path like this :

objFSO.DeleteFile "\\192.168.2.241\test.txt",true
OR
objFSO.DeleteFile "\\machinename\test.txt",true




I have tried with IP Address as well as Machine name but error comes like netwrok path not found,infact network path is correct. I have tried it as follow

Expand|Select|Wrap|Line Numbers
  1. Dim objFSO,filename
  2. Set objFSO = CreateObject("Scripting.FileSystemObject")
  3. objFSO.DeleteFile "\\\\192.168.2.241\\c:\\test.txt",true
  4.  
But i got error like Network Path was not found same in the case of Machine name
Nov 16 '07 #6
Hi have already tried like you told but i got error "File Not Found"
Please help me out from this

Hi,

Try to give path like this :

objFSO.DeleteFile "\\192.168.2.241\test.txt",true
OR
objFSO.DeleteFile "\\machinename\test.txt",true
Nov 19 '07 #7
jhardman
3,406 Expert 2GB
someone recently told me you have to use wscript.shell (I'm not sure if I spelled that right) to do that, but I have never tried. I think it works similar to scripting.fileSystemObject

Jared
Nov 19 '07 #8
Hi shweta,
Thanks a lot your code working fine now,Previously i forgot to enable "full control" attribute of that file without which we cant delete remote file.
Thanks a lot.
Bye Take care
Hi,

Try to give path like this :

objFSO.DeleteFile "\\192.168.2.241\test.txt",true
OR
objFSO.DeleteFile "\\machinename\test.txt",true
Nov 26 '07 #9
Hi,

Use Filesystemobject to deal with the files.
e.g.
Expand|Select|Wrap|Line Numbers
  1.       <%
  2.  
  3.                      Dim fso
  4.                      Dim filename
  5.                      set fso = Server.CreateObject("Scripting.FileSystemObject")
  6.  
  7.                      ''''Path of the file to be deleted
  8.                      filename = "\example.txt"   
  9.  
  10.                      '''Check if file exists before deleting
  11.  
  12.                      If fso.FileExists(filename) then
  13.                           ''''Delete the file
  14.                           fso.DeleteFile(filename)
  15.                     else
  16.                          Response.write("File does not exists")
  17.                     end if 
  18.                     set fso = nothing
  19.        %>
Hi,
I need open the file in different system.How can i open that file in my system.There systems are all in local network.Please send me the solution asap.it is developing the applications in .net
Thanks a lot.
Jan 31 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Jennifer Smith | last post by:
Currently we have a site that allows users to listen to mp3 files. It is creating bandwidth issues. So we want to move the mp3 files to an ISP that caps bandwidth usage. Ours is currently...
7
by: iqbal | last post by:
Hi all, We have an application through which we are bulk inserting rows into a view. The definition of the view is such that it selects columns from a table on a remote server. I have added the...
2
by: Daniel | last post by:
when i use stream writer to write to a shared folder, and the network card of that remote computer is disabled in the middle of the write then reenabled later. every time i try to write to that...
0
by: bettervssremoting | last post by:
To view the full article, please visit http://www.BetterVssRemoting.com Better VSS Remote Access Tool including SourceOffSite, SourceAnyWhere and VSS Remoting This article makes a detailed...
15
by: =?Utf-8?B?TVNU?= | last post by:
To demonstrate my problem, I have a very simple VB Windows application. It has a text box that is used to display a counter, a button to reset the counter, and a timer that increments the counter...
1
by: sphinney | last post by:
All, I'm not sure how to adequately explain my problem in two sentences or less, so at the risk of providing TMI, here's the condensed verion. I have developed an Access 2002 database file that...
11
by: =?Utf-8?B?U2FsYW1FbGlhcw==?= | last post by:
Has anybody worked with performancecounter object to access counters on remote machine? I managed to write code that retrieves counters categories froma remote machine, when I try another remote...
5
by: =?Utf-8?B?QWRyaWFuTW9ycmlz?= | last post by:
Hello! I'm trying to copy a file from another computer on the network that I do not have permission with my current logon details to access. If I open the folder using the Windows file manager...
2
by: limperger | last post by:
Hello everyone! I do not know if it is possible to do something like this in Access but let me try to ask: Is there any way to insert in an Access field a shortcut to an office file, being all the...
7
by: luker | last post by:
Hello Experts, I am writing an application for a device running windows xp embedded. I want to code on my developer pc and deploy the running executable to the embedded device. - The two boxes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.