Find Commands: Difference between revisions

From Cramsession
Jump to navigationJump to search
✍️ Verified Author: MflavellClick to view professional profile & credentials
(Created page with "<h1>Files in current folder modifed toay</1h1> find . time -1 type f printf "%f\n" <i>-1 can be changed to another value to o back further </I>")
 
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
<h1>Files in current folder modifed toay</1h1>
[[Tech Notes]] > [[Linux]] > Find Commands


find . time -1 type f printf "%f\n"


<i>-1 can be changed to another value to o back further </I>
=Files in current folder modified today=
 
find . -mtime -1 -type f
 
if you just want the filename:
 
find . -mtime -1 -type f printf "%f\n"
 
'''-1 can be changed to another value to go back further'''
 
 
=Recursive find=
 
find . -iname "<i>fidnme</i>*"
 
=Find a file that starts with name_=
 
find . -type f -name "name_*"
 
= File delete using Find =
 
Delete all files more than ''M'' days in current folder
 
find . -type f -mtime +''M'' -exec rm {} \;

Latest revision as of 21:09, 19 May 2025

Tech Notes > Linux > Find Commands


Files in current folder modified today

find . -mtime -1 -type f

if you just want the filename:

find . -mtime -1 -type f printf "%f\n"

-1 can be changed to another value to go back further


Recursive find

find . -iname "fidnme*"

Find a file that starts with name_

find . -type f -name "name_*"

File delete using Find

Delete all files more than M days in current folder

find . -type f -mtime +M -exec rm {} \;