How to find all the files created today and modified anytime before 5 minutes?
Since -daystart
isn't that portible, consider a solution like so;
Use
$(date +"%H")
to get the current hour, in your test case, this should be10
.Multiply that number by 60 to get the desired minutes
Subtract 5 minutes to get the number of minutes between 00:00 and 09:55
Use that value for the
-mmin
param
currentHour=$(date +"%H")
minutes=$(( 60 * currentHour - 5 ))
find . -mmin "-${minutes}" -mmin +5
Find files modified over 1 hour ago but less than 3 days
Find has -mtime and -mmin:
find . -mtime +3 -mmin -60
From the find manual:
Numeric arguments can be specified as:
+n for greater than n
-n for less than n
n for exactly n
Bash - How to find files that are not modified within a given time period?
Here's another approach (probably requires GNU coreutils)
touch -d "10 minutes ago" refFile
find . -type f -not -newer refFile
How to find files in ruby which were edited in some time interval?
You could get a list of files using Dir.[]
, and use File.mtime
on each one to filter them:
Dir["*"].select { |fname| File.mtime(fname) > (Time.now - 60) }
Related Topics
Multiplication with Expr in Shell Script
Bash: Run an Executable File in Background
Use Find Command But Exclude Files in Two Directories
How to Start Docker Service in Ubuntu 16.04
Linux Sched_Other, Sched_Fifo and Sched_Rr - Differences
Linux Execute Command Remotely
Howto Prepare Qtcreator for Linux Driver & Kernel Development
A Running Bash Script Is Hung Somewhere. How to Find Out What Line It Is On
Finding Human-Readable Files on Unix
How to Run Script Commands from Variables
Bpf Verifier Rejects Code: "Invalid Bpf_Context Access"
What Should I Choose: Gtk+ or Qt
Readelf VS. Objdump: Why Are Both Needed
Docker Bash Prompt Does Not Display Color Output
Rsync How to Include Directories But Not Files
How to Convert Pptx Files to Jpg or Png (For Each Slide) on Linux