Register
It is currently Tue Jul 29, 2014 6:44 am

Any ideas?


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Thu Aug 27, 2009 11:58 am   

Joined: Tue Aug 25, 2009 2:12 pm
Posts: 2
Hi
I m trying to write a script which finds the most recent text file from each subfolder in a directory tree and merges the contents of every recent file in a new file.
I m trying something like this to fid the most recent files :(test is the name of the directory I want to scan)

Code:
for c in test/*; do ls -1 -t test | head -1 ; done

but it gives me the same file for every directory tree.

Any ideas?
Thanx in advance


Top
 Profile  
 PostPosted: Thu Aug 27, 2009 10:29 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 533
something like this
Code:
find . -type d -exec bash -c 'ls -1 -t {} | head -1' \;
?


Top
 Profile  
 PostPosted: Thu Sep 10, 2009 3:07 pm   

Joined: Tue Aug 25, 2009 2:12 pm
Posts: 2
That gave me some ideas.

Thank you very much!


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP