Giter Site home page Giter Site logo

recentmost's Introduction

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.

recentmost's People

Contributors

shadkam avatar

Stargazers

 avatar  avatar  avatar eg avatar johnny avatar Perry Kollmorgen avatar Marc-Antoine Minville avatar Andy avatar Matt Sylvia avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.