• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Directory/File comparison tool using Java.

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Kedlu Nanu
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Hold that thought. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic