469,276 Members | 1,943 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

Looking for Folder

This is what I'm trying to do:
  1. Find newest folder in directory
  2. Open a file called components.txt in that folder
  3. Look for specific text in that text file.
  4. If it is found then exit this loop and call next method.
  5. If it is not found then recurse back and look for the next latest folder.
  6. Repeat from Step 2.

The main problem I'm having is how to find a folder based on it's modified time. Is there a method that will look for a folder that was modified before or after a specified time?
Nov 22 '07 #1
4 1182
eWish
971 Expert 512MB
The stat function will be what you need for the file date/time data.

--Kevin
Nov 22 '07 #2
Thanks, the stat function is going to be useful. But theres one other problem I just realized. stat needs a foldername to work. The problem is I don't know the foldernames. The folder names in this directory are unknown to me and I want the script to go through all of the folders and check the date. How do you think I could do this?
Nov 22 '07 #3
numberwhun
3,503 Expert Mod 2GB
Thanks, the stat function is going to be useful. But theres one other problem I just realized. stat needs a foldername to work. The problem is I don't know the foldernames. The folder names in this directory are unknown to me and I want the script to go through all of the folders and check the date. How do you think I could do this?
Well, if you are on the system, then you could issue a system command to collect a 'dir' (windows) or 'ls' (*nix) and store it in an array. Then, parse each line for the folder names (possibly into another array) and use that new array as your list of folders.

Just my .02.

Regards,

Jeff
Nov 22 '07 #4
Ya that'll work..not sure why I didn't think of that.. Now I don't even need the stat function cause I can do a Sort on my DIR. Thanks for the help!
Nov 26 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by ray well | last post: by
6 posts views Thread by pasmod | last post: by
9 posts views Thread by =?Utf-8?B?anAybXNmdA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.