Skip to content

shadkam/recentmost

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

recentmost

gvien a basedir, find most recently modified files

Why This

many a times we want to find out most recently modified files on system within a directory - it may be codebase, or configuration files, where we might have been changing things in order to make it work - but in the end when it finally would begin to work, we may have lost track of which files had we touched.

Existing ways to achieve it

There are already ways to query most recently modified files, One is (we'll call it existingCmds1):

$ find ~/ -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort  | tail -20

(where 20 is the number of most recently modified files one would like to get).

existingCmds1 works, if one's "find" supports -printf option (find found on many of the systems do not). Plus existingCmds1 takes lot more time than needed.

Another way to achieve it is (let us call it existingCmds2):

$ find ~/xtg-main/ -type f|grep -v " "|xargs ls -lrt | tail -20

but xargs starts splitting the arguments if they are too long - so existingCmds2 does not achieve the objective.

To Build / Run

Unix

$ gcc -Wall -Wextra -o recentmost recentmost.c
$ find ~/ -type f|./recentmost 20

Windows

To build, go to Visual Studio Cmd Prompt,

$ cl.exe recentmost.c

To run, Go to the dir where recently modified files are to be looked for,

$ dir /b/s/A-D | /path/to/recentmost.exe 20

Performance

On my system (linux), existingCmds1 is taking ~9 secs on a dataset, and recentmost for the same dataset, takes just ~1 sec.

About

find files modified most recently in O-log-k

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages