Hello,
Anyone know of a program or class that takes in a directory,
recursively scans that directory for any files or subdirectories for a
criteria, (say over 1 year old), and then can output those file names?
Thank you!
Patrick
Monique Y. Mudama - 14 Dec 2005 16:45 GMT
> Hello,
>
[quoted text clipped - 4 lines]
>
> Thank you! Patrick
Does it need to be multi-platform? Because that sounds like a job for
some scripts in a shell environment.

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Prime - 14 Dec 2005 17:43 GMT
Monique:
multiplatform would be best, as the environment is windows but might
eventually switch to Red Hat.
Patrick
Abhijat Vatsyayan - 14 Dec 2005 18:02 GMT
Haven't tested it but something like (you will definitely need to modify
this)-
public static void listDirs(Collection fileCollection, File
baseDir, FileFilter filter)
{
File children[] = baseDir.listFiles(filter);
for (int i = 0; i < children.length; i++)
{
File childFile = children[i];
if(childFile.isDirectory())
{
listDirs(fileCollection,childFile,filter);
}
fileCollection.add(childFile);
}
}
I do not know how this will work for symbolic links (infinite loops!).
> Hello,
>
[quoted text clipped - 4 lines]
> Thank you!
> Patrick
Gordon Beaton - 14 Dec 2005 18:03 GMT
> Anyone know of a program or class that takes in a directory,
> recursively scans that directory for any files or subdirectories for
> a criteria, (say over 1 year old), and then can output those file
> names?
GNU find, like this:
find . -mtime +365
http://www.gnu.org/software/findutils/findutils.html
/gordon

Signature
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
Prime - 14 Dec 2005 20:42 GMT
iamfractal@hotmail.com - 15 Dec 2005 08:56 GMT
>From the source's mouth:
http://www.javapractices.com/Topic68.cjp
.ed
--
www.EdmundKirwan.com - Home of The Fractal Class Composition.