Smart XCopy

R

Roedy Green

Is there a utility around, preferably with Java source, that is like
XCOPY to copy directory trees, or just the *.java files in a directory
tree to matching tree with this wrinkle.

It suppresses the copy of the target file is already identical. E.g.
It does not copy unless the target in older or does not exist.

It should create new directories as needed.

4NT copy has a /U option, but the /S option does not work for
wildcards. XCOPY itself has no /U option.

If someone wants to write one, they could use FileTransfer
http://mindprod.com/products1.html#FILETRANSFER to do the copies. I
have some code to show how you scan the tree recursively.

The hard part is parsing the command line and it various
abbreviations.
 
A

Andy

Roedy said:
Is there a utility around, preferably with Java source, that is like
XCOPY to copy directory trees, or just the *.java files in a directory
tree to matching tree with this wrinkle.
This is the sort of thing Ant does very well.
 
T

Thomas Weidenfeller

Roedy said:
Is there a utility around, preferably with Java source, that is like
XCOPY to copy directory trees, or just the *.java files in a directory
tree to matching tree with this wrinkle.

It suppresses the copy of the target file is already identical. E.g.
It does not copy unless the target in older or does not exist.

rsync (didn't we already discuss this some time ago?). Works not only
remotely, but also for local files. But it's C, not Java.

Since you are a Windows guy, you probably want the Cygwin version
http://www.cygwin.com/ Unix/Linux people often get it with their OS.

/Thomas
 
D

David Segall

Roedy Green said:
Is there a utility around, preferably with Java source, that is like
XCOPY to copy directory trees, or just the *.java files in a directory
tree to matching tree with this wrinkle.

It suppresses the copy of the target file is already identical. E.g.
It does not copy unless the target in older or does not exist.

It should create new directories as needed.

4NT copy has a /U option, but the /S option does not work for
wildcards. XCOPY itself has no /U option.

If someone wants to write one, they could use FileTransfer
http://mindprod.com/products1.html#FILETRANSFER to do the copies. I
have some code to show how you scan the tree recursively.

The hard part is parsing the command line and it various
abbreviations.
The fact that you specified XCOPY allows me to assume that you are
talking about Windows.

Microsoft's Robocopy, which is part of the Windows Server 2003
Resource Kit Tools, has so many options it is unlikely that there is
not a combination that will do what you want. It works with XP and
probably previous derivatives of NT. It is a free download from here -
<http://www.microsoft.com/downloads/...69-57ff-4ae7-96ee-b18c4790cffd&DisplayLang=en>
Sorry, it does not come with Java source.
 
L

Luc The Perverse

Roedy Green said:
Is there a utility around, preferably with Java source, that is like
XCOPY to copy directory trees, or just the *.java files in a directory
tree to matching tree with this wrinkle.

It suppresses the copy of the target file is already identical. E.g.
It does not copy unless the target in older or does not exist.

It should create new directories as needed.

4NT copy has a /U option, but the /S option does not work for
wildcards. XCOPY itself has no /U option.

If someone wants to write one, they could use FileTransfer
http://mindprod.com/products1.html#FILETRANSFER to do the copies. I
have some code to show how you scan the tree recursively.

The hard part is parsing the command line and it various
abbreviations.


I was going to create something similar for creating backups, but it was
going to work off checksums and filesizes. But it was going to be a GUI
app. Making a console app might make more sense.

But I don't see what you mean is difficult about "various abbreviations".
Paths and relative paths should be easily passed into the system and the
only thing you would need worry about would be wild cards right?
 
R

Roedy Green

But I don't see what you mean is difficult about "various abbreviations".
Paths and relative paths should be easily passed into the system and the
only thing you would need worry about would be wild cards right?

Think of DOS copy. you can leave off various combinations of drive,
directory, filename on source and target, filling in defaults from the
CWD. You might have wildcards of various flavours, possibly multiple
wildcards, The target directories may not exist.

You may have URLS instead of filenames.

Just copying one fully qualified filename to another is the least of
your problems. FileTransfer does that for you.
 
L

Luc The Perverse

Roedy Green said:
Think of DOS copy. you can leave off various combinations of drive,
directory, filename on source and target, filling in defaults from the
CWD. You might have wildcards of various flavours, possibly multiple
wildcards, The target directories may not exist.

You may have URLS instead of filenames.

Maybe I have just never tried it - it just doesn't seem like it would be
that hard. Of course, I am often suprised.
Just copying one fully qualified filename to another is the least of
your problems. FileTransfer does that for you.

Will FileTransfer transfer to an FTP server? I the product listed but not
an explanation

I need to find a way to send from one Java client directly to another Java
client for the project I was talking about making.

GTGE is so much fun that the only thing I've been doing with Java is making
games instead of actually trying to make some projects which might have some
practical use.
 
R

Roedy Green

Will FileTransfer transfer to an FTP server? I the product listed but not
an explanation

Filetransfer does not speak FTP. It will do a GET of a file from an
HTTP server though. It can read and write Input and Output Streams
you set up. It will copy to and from files. Basically it just handles
the chunking logic for you and dealing with reads that don't hand over
as many bites and requested.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top