?
Solved

xxcopy single file copy in Java fails with double spaces in filename

Posted on 2009-04-16
2
Medium Priority
?
285 Views
Last Modified: 2012-06-21
I'm using xxcopy to do single file copies in a Java program.  All is well, unless the filename contains two consecutive spaces.

cmd /c xxcopy  "c:\source\folderx\file  name.doc" "c:\dest\foldery\"  /VL /C /H /K /YY /Q3

The code looks something like this, where sExec is the string above:
            Process p = Runtime.getRuntime().exec(sExec);
            p.waitFor();
            iRtn = p.exitValue();

I'm outputting the exact value of "sExec", and then copying it into Start/Run.  It runs successfully from Start/Run.  Does anyone understand why this same command fails when run from a Java program?

jkavx
0
Comment
Question by:jkavx
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 24162788
try tyhis:

exec(new String[] { "cmd", "/c", "xxcopy", "c:\source\folderx\file  name.doc" ,"c:\dest\foldery\" , "/VL", "/C", "/H", "/K", "/YY", "/Q3"});

0
 

Author Closing Comment

by:jkavx
ID: 31571186
Thanks very much.  
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

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…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

807 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