467,104 Members | 1,029 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

how to find a last updated directory?

Suppose I have a set of directories as lane1, lane2, lane3, file1, file2..under /home/userrig/test in a linux server. And the last updated directory is lane3.

lane1, lane2 and lane3 are directories and file1 and file2.. are under files under /home/userrig/test.

I am only interested in directory that starts with
Expand|Select|Wrap|Line Numbers
  1. lane

How do I collect this information? Infact after cheking for the last updated directory, I have to change to that directory and execute a command in
Expand|Select|Wrap|Line Numbers
  1. system("execute");
method.

Is there any function to sort the directory according to time like "ls - lt" as in unix command? Please let me know how to proceed?

Thanks and Regards
Jul 16 '08 #1
  • viewed: 2519
Share:
3 Replies
Any expert advice or suggestions needed please.
Jul 17 '08 #2
Suppose I have a set of directories as lane1, lane2, lane3, file1, file2..under /home/userrig/test in a linux server. And the last updated directory is lane3.

lane1, lane2 and lane3 are directories and file1 and file2.. are under files under /home/userrig/test.

I am only interested in directory that starts with
Expand|Select|Wrap|Line Numbers
  1. lane

How do I collect this information? Infact after cheking for the last updated directory, I have to change to that directory and execute a command in
Expand|Select|Wrap|Line Numbers
  1. system("execute");
method.

Is there any function to sort the directory according to time like "ls - lt" as in unix command? Please let me know how to proceed?

Thanks and Regards

I replied to ur last post also, here is the code that gets the latest directory whose name starts with lane.

Expand|Select|Wrap|Line Numbers
  1. my $latest_dir = (grep { chomp; /^lane/i } `ls -t`)[0];
regs,
Jul 17 '08 #3
Thank you so much. As I overlooked my previous message, I couldn't respond. Sorry for the confusion caused.
Jul 17 '08 #4

Post your reply

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

Similar topics

1 post views Thread by Amanda | last post: by
4 posts views Thread by kieran | last post: by
2 posts views Thread by Warmbells | last post: by
6 posts views Thread by Mudcat | last post: by
1 post views Thread by Larry L [in Honolulu] | last post: by
1 post views Thread by mosesdinakaran@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.