From: Rhino on 4 Feb 2010 14:13 Can anyone point me to an example of Java code that searches for all the files within a given Windows directory (and doesn't recurse into subdirectories) and then stores the file names in some kind of array or collection? For example, if my directory was c:\foo, it would store a list of all the files found in the foo directory. I've lost most of my old code examples due to a hard drive crash and feel sure that this kind of code must have been done umpteen times before. I'll write it from scratch if I have to but I'm hoping some kind soul can point me to an example or just post it directly.... -- Rhino
From: Eric Sosman on 4 Feb 2010 14:29 On 2/4/2010 2:13 PM, Rhino wrote: > Can anyone point me to an example of Java code that searches for all the > files within a given Windows directory (and doesn't recurse into > subdirectories) and then stores the file names in some kind of array or > collection? For example, if my directory was c:\foo, it would store a list > of all the files found in the foo directory. > > I've lost most of my old code examples due to a hard drive crash and feel > sure that this kind of code must have been done umpteen times before. I'll > write it from scratch if I have to but I'm hoping some kind soul can point > me to an example or just post it directly.... String[] names = new File("c:\\foo").list(); I hope your new drive has enough room for this. -- Eric Sosman esosman(a)ieee-dot-org.invalid
From: Roedy Green on 4 Feb 2010 15:23 On Thu, 4 Feb 2010 14:13:59 -0500, "Rhino" <no.offline.contact.please(a)example.com> wrote, quoted or indirectly quoted someone who said : >Can anyone point me to an example of Java code that searches for all the >files within a given Windows directory (and doesn't recurse into >subdirectories) and then stores the file names in some kind of array or >collection? For example, if my directory was c:\foo, it would store a list >of all the files found in the foo directory. see http://mindprod.com/products1.html#COMMANDLINE -- Roedy Green Canadian Mind Products http://mindprod.com You can�t have great software without a great team, and most software teams behave like dysfunctional families. ~ Jim McCarthy
From: Rhino on 4 Feb 2010 15:44 "Eric Sosman" <esosman(a)ieee-dot-org.invalid> wrote in message news:hkf774$jeg$1(a)news.eternal-september.org... > On 2/4/2010 2:13 PM, Rhino wrote: >> Can anyone point me to an example of Java code that searches for all the >> files within a given Windows directory (and doesn't recurse into >> subdirectories) and then stores the file names in some kind of array or >> collection? For example, if my directory was c:\foo, it would store a >> list >> of all the files found in the foo directory. >> >> I've lost most of my old code examples due to a hard drive crash and feel >> sure that this kind of code must have been done umpteen times before. >> I'll >> write it from scratch if I have to but I'm hoping some kind soul can >> point >> me to an example or just post it directly.... > > String[] names = new File("c:\\foo").list(); > > I hope your new drive has enough room for this. > > -- > Eric Sosman > esosman(a)ieee-dot-org.invalid I'm _REALLY_ rusty on my Java - haven't touched it in almost 4 years and I feel like I've forgotten almost everything. For some reason, I thought that was going to be more involved that it was. Thanks, Eric! -- Rhino
From: Rhino on 4 Feb 2010 15:44 "Roedy Green" <see_website(a)mindprod.com.invalid> wrote in message news:luamm5pkpbos5kdrjaruvp7j2k3fns5220(a)4ax.com... > On Thu, 4 Feb 2010 14:13:59 -0500, "Rhino" > <no.offline.contact.please(a)example.com> wrote, quoted or indirectly > quoted someone who said : > >>Can anyone point me to an example of Java code that searches for all the >>files within a given Windows directory (and doesn't recurse into >>subdirectories) and then stores the file names in some kind of array or >>collection? For example, if my directory was c:\foo, it would store a list >>of all the files found in the foo directory. > > see http://mindprod.com/products1.html#COMMANDLINE > -- > Roedy Green Canadian Mind Products > http://mindprod.com > > You can't have great software without a great team, and most software > teams behave like dysfunctional families. > ~ Jim McCarthy Thank you!
|
Next
|
Last
Pages: 1 2 3 Prev: Protected nested generic constrained inheritance Next: Motivation of software professionals |