aspose file tools*
The moose likes Java in General and the fly likes Directory/File comparison tool using Java. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Directory/File comparison tool using Java." Watch "Directory/File comparison tool using Java." New topic
Author

Directory/File comparison tool using Java.

Kedlu Nanu
Greenhorn

Joined: May 05, 2004
Posts: 6
Hello Everybody,
I have to build a tool for Direcotry/File comparison ( ASCII, TEXT, BYTE ) any format. I am thinking of building with Java for platform independence.
So does anybody have any idea how should I proceed.
I have to be really quick. It would be really nice to start with inputs from Java gurus.
Thanks,
Nanu
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Not a very hard thing to do. You'll make heavy use of the java.io.File class, so go off and read the whole API page for it. File is what you'll use to find out if something is a directory and to list a directory.
The first thing to do is probably to sit down and write down exactly what the program's interface should be like, and what exactly it should do in various situations. From your brief problem description here, there are many different ways you could go.


[Jess in Action][AskingGoodQuestions]
Kedlu Nanu
Greenhorn

Joined: May 05, 2004
Posts: 6
Hi Ernest,
I have to develop commandline interface for this tool, which will take care of all the forms of file I mentioned in my previous post disregarding the time stamp. Also, I have one question, can we convert TEXT file to byte code with java for the comparison purpose?
I am new to this tool and never used one, so if you can provide me with little more description of the ways I can opt for it will be really nice.
Thanks,
Nanu
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Here's the doc for something I did in Pascal, first version in DOS about 1987, last version with a nifty GUI. It compares directories and files by timestamps. Comparing files by content would be an interesting addition. See if it gives you any ideas. I'd be happy to talk about the algorithms.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Given such a requirement (which may be bogus), I would be focusing on what I believe is the most difficult part: creating an algorithm that determines the type of the file given the file's attributes.
Some questions that I'd first answer:
Is it a text file if it contains only printable characters ?
What exactly is a printable character ?
etc. etc.
Using the core API to do the rest is relatively trivial.


Tony Morris
Java Q&A (FAQ, Trivia)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Directory/File comparison tool using Java.