Solved

VB 6 Example of deleting a file on a remote computer

Posted on 2007-03-19
3
182 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 video teaches viewers about errors in exception handling.

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now