Find today created files

find -maxdepth 1 -type f -newermt "00:00" -printf "%f\n" | sort
Finds files modified today since 00:00, removes ugly dotslash characters in front of every filename, and sorts them. *EDITED* with the advices coming from flatcap (thanks!)

-2
By: TetsuyO
2013-03-23 12:50:01

2 Alternatives + Submit Alt

What Others Think

Sorry, that's not very good. For two reasons. First, "-newmt" takes a date(1) type string. find -maxdepth 1 -type f -newermt "00:00" | cut -c3- | sort Second, if you're only looking for files in the current directory, then let find do the formatting for you: find . -maxdepth 1 -type f -newermt "00:00" -printf "%f\n"
flatcap · 277 weeks and 4 days ago
flatcap, thank you for your advices! :-)
TetsuyO · 277 weeks and 4 days ago
I've already posted this elsewhere in reference to a post of the same nature (honestly, I really don't get how commands are grouped together, it seems that duplicates abound, but don't show as being 'Alternatives'). The zsh eq (using globbing and a glob modifier) is: print -rl **/*(.m0)
khayyam · 277 weeks and 2 days ago
sorry .. that "**/" is a recursive ... for maxdepth=1 you should use: print *(.m0)
khayyam · 277 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: