osx - Find newest file in folder via the terminal (seconds apart) -


i trying extract newest file in folder. tried this:

ls -1t | head -1 

but problem is, command doesn't seem differentiate in second file created - if multiple files created in the same, command give first file in minute.

is there way make command more precise?

you should add t argument options that:

ls -1tt | head -1 

see output when l argument added:

ls -ttl  -rw-r--r--  1 user  wheel      0 apr 23 17:54:27 2016 1 -rw-r--r--  1 user  wheel      0 apr 23 17:54:19 2016 3  -rw-r--r--  1 user  wheel      0 apr 23 17:54:12 2016 2 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -