Skip to content

Instantly share code, notes, and snippets.

Last active Sep 19, 2020
What would you like to do?
Useful find command.

Note this command.

find . -not -path '*/\.*' -iname '*' -maxdepth 1 -mtime -1

Let's cut it open and see what's happening.

  1. find .: This says find in the current directory (. is cwd).
  2. -not -path '*/\.*': This says not to match dot (hidden) files.
  3. -iname '*': This says match * (any name). The i in iname is for case-insensitive.
  4. -mtime -1: This says only match files which are modified less than 1 day(s) ago. If - is turned to +, it will say only match files which are not modified after one day which is same as matching every file which are modified after one day.
  5. -maxdepth 1: This says only go 1 level deep in the tree.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment