Solved

Copy/Move program using Java

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

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

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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 …

759 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

18 Experts available now in Live!

Get 1:1 Help Now