Solved

Copy/Move program using Java

Posted on 1998-07-19
2
195 Views
Last Modified: 2010-03-30
Could anybody suggest me please to write Copy and Move programs for copying and moving files from one directory to another?, these programs should work like dos/windows copy and move commands.
I use Win95, jdk1.2bata3
0
Comment
Question by:hvhemant
2 Comments
 
LVL 2

Accepted Solution

by:
threshold earned 10 total points
ID: 1227087
Moving files is easy in Java. Try java.io.File.rename(File)... to specify the pathname to perform the moving of file.

Copying is more difficult, you can open a FileInputStream and a FileOutputStream to copy a file.

Or use the java.lang.Runtime.exec(...) to excute DOS command in new Process, it's more easy in Java Application.
0
 
LVL 1

Expert Comment

by:dryang
ID: 1227088
"..these programs should work like dos/windows copy and move commands. "

use the 'argv' string arry to help you manupilate your texxt commands
eg
public static void main(String argv[ ])
                                                     ^-this one...
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

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 38
Modeling a class in java 5 44
eclipse formatting 6 70
Groovy:unable to resolve class error 2 66
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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.

929 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

11 Experts available now in Live!

Get 1:1 Help Now