Solved

Copy/Move program using Java

Posted on 1998-07-19
2
198 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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 65
web application structure 18 103
Detect Closed Loops (circles, figure-8s, etc) in PNG Images 6 58
Java class and jar 3 25
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

820 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