Program to list all dirs, subdirs and files older than 1 year

P

Prime

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
 
M

Monique Y. Mudama

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

Does it need to be multi-platform? Because that sounds like a job for
some scripts in a shell environment.
 
P

Prime

Monique:

multiplatform would be best, as the environment is windows but might
eventually switch to Red Hat.

Patrick
 
A

Abhijat Vatsyayan

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;
if(childFile.isDirectory())
{
listDirs(fileCollection,childFile,filter);
}
fileCollection.add(childFile);
}
}
I do not know how this will work for symbolic links (infinite loops!).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top