Quantcast
Channel: Find the latest file by modified date - Ask Ubuntu
Browsing all 7 articles
Browse latest View live

Answer by MUY Belgium for Find the latest file by modified date

Use perl in conjonctin with find : find my_directory -type f -printf '%T@\t%p\n' | perl -ane '@m=@F if ($F[0]>$m[0]); END{print $m[1];}'You get the name of the file with the greatest epoch == last...

View Article



Answer by Pat Regan for Find the latest file by modified date

I had a similar problem today, but I attacked it without find. I needed something short I could run over ssh to return the most recently edited file in my home directory. This is roughly what I came up...

View Article

Answer by Prasanth S for Find the latest file by modified date

EDIT: I guess this post is not 'not particularly useful' as I thought it was. This is a really fast solution that just keeps track of the most recently modified file (instead of sorting the entire list...

View Article

Answer by Sergey for Find the latest file by modified date

It's not nearly as fashionable, but it's also possible to achieve this with Midnight Commander: search for *, panelize the result, sort by modification time in reverse order.Obviously, it's a bit...

View Article

Answer by arrange for Find the latest file by modified date

This is on my system faster than printf, though I don't understand whyfind /path -type f -exec stat -c "%y %n" {} + | sort -r | head

View Article


Answer by enzotib for Find the latest file by modified date

You do not need to recur to external commands (as ls) because find can do all you need through the -printf action:find /path -printf '%T+ %p\n' | sort -r | head

View Article

Find the latest file by modified date

If I want to find the latest file (mtime) in a (big) directory containing subdirectories, how would I do it?Lots of posts I've found suggest some variation of ls -lt | head (amusingly, many suggest ls...

View Article
Browsing all 7 articles
Browse latest View live




Latest Images