Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2007

Tip: Looking for answers? Try searching our database.

How to read files in specific sequence from two different directories?

Thread view: 
kdsutaria - 17 Feb 2007 20:10 GMT
hi!
        I hv to read two files together from different dirs and need
to find pair of word frequency and document frequency of this pair of
word.
for example.
both  dirs has 10000 .xml files and having  partial same name to
recognize two pair of files.

T1.xml      from A dir   L1.xml from B dir
words

a,b,c                                  a1,b1

i need to find word frequency and document frequency  of
aa1,ab1,ba1,bb1,ca1,cb1.

can any one suggest me , How do i read and recognize two files from
two different directory ?
ksut
Boaz.Jan@gmail.com - 17 Feb 2007 23:34 GMT
> hi!
>          I hv to read two files together from different dirs and need
[quoted text clipped - 15 lines]
> two different directory ?
> ksut

im sure this thread will help you on some of the frequency thing you
asked for
http://groups.google.com/group/comp.lang.java.programmer/browse_thread/thread/99
51cc38c938ae34/0e245cef97d7a9cf?lnk=raot#0e245cef97d7a9cf


for the file itrating in the directory for the corrasponding file (i
hope i understood what you want to do...) you can do so with the
"File" class

http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html

it represnet a Entity in the FileSystem (File, Dir and whatever)
you will find these methods usefull:
isDirectory()
isFile()
list()
list(FilenameFilter filter)
listFiles()
listFiles(FilenameFilter filter)
getPath()

after you got all the files into object just parse the relavnt data of
each path from each file (the File.listFiles() method return a
File[] ) and search for the corresponding file at the other File[]
for the reading part just use a bufferdreader (http://java.sun.com/
docs/books/tutorial/essential/io/index.html)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.