blue-sky
blue-sky

Reputation: 53916

Find files by extension

How can I modify the below command to find all files modified in last day that have extension of .log ?

Here is the command so far :

find . -mtime -1 -print

Upvotes: 0

Views: 99

Answers (3)

MartyE
MartyE

Reputation: 666

find . -mtime -1 -iname '*.log'

Note: Using double quotes instead of single quotes will likely give unexpected results due to shell expansion.

Upvotes: 1

jkshah
jkshah

Reputation: 11713

Use -name option to find files by particular name

find . -mtime -1 -name "*.log" -print

Notice the use of wildcard character * to find all files ending with .log

Upvotes: 1

Jim Garrison
Jim Garrison

Reputation: 4276

find . -name \*.log -mtime -1 -print

Upvotes: 2

Related Questions