Solved

VB 6 Example of deleting a file on a remote computer

Posted on 2007-03-19
3
181 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:mayankeagle
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:
mayankeagle 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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