Solved

VB 6 Example of deleting a file on a remote computer

Posted on 2007-03-19
3
183 Views
Last Modified: 2010-03-31
Last job wrote a program to logon to another server, delete a file in a certain directory.  Unfortunely didnt bring code to new job.  Does anyone have a example of connecting to a server using a certain userid and password and then deleting a file from a directory?
0
Comment
Question by:TheVeee
  • 2
3 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18750147
Are you looking for a  VB 6 example? If so why did you post it in the Java forum?

If you're looking for a Java example, you can use the java.io.File class:

File f = new File ( "Shared file path" ) ;

if ( f.exists () )
  f.delete () ;
0
 
LVL 5

Author Comment

by:TheVeee
ID: 18750212
I can write it with either language.. just wanted the best solution from both worlds to make my choice...

You're example takes it a a granted your logged in and mapped to the drive.. I wont be.  We support 40 servers so I just dont want to map all 40 servers to my local machine.  Im looking for something like...

1.  From my machine run the application
2.  For each machine do the following
     a.  Log onto remote server using a generic userid and password
     b.  Then do you code from above.
     c.  Then Log off remote server
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 18750406
It doesn't assume it to be mapped - you can just provide the remote path without mapping it to a drive.

You can change the user ID/ password with which you want to log on by setting it in the system properties: http://java.sun.com/docs/books/tutorial/essential/environment/sysprop.html

0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question