?
Solved

Copy/Move program using Java

Posted on 1998-07-19
2
Medium Priority
?
209 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
threshold earned 20 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

771 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