How to find all files modified from midnight (i.e. from midnight (00:00:00)) of current date?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to find all files modified from midnight (i.e. from midnight (00:00:00)) of current date?
# 1  
Old 01-08-2015
How to find all files modified from midnight (i.e. from midnight (00:00:00)) of current date?

Hi there!

I was wondering if someone could help me with the following:

I'm trying to find all files within a directory which have been modified since midnight of the current date.

Any help would be appreciated.

Thank you kindly.
# 2  
Old 01-08-2015
Use touch to set a file with the desired start time and then use:
Code:
find directory_name -newer start_time_file ...

to list your desired files.
# 3  
Old 01-08-2015
Hi there,

Thank you for your reply, but could you please tell me how I would go about not hard-coding a specific filename, rather hard coding a specific time (00:00:00)?

Thank you.
# 4  
Old 01-08-2015
I did!

Did you look at the touch man page to see how to create a file with a given timestamp? Did you look at the find man page to see how the -newer file primitive can be used to find files newer than a given timestamp?

This is the Shell Programming And Scripting forum (not the UNIX for Dummies Questions & Answers forum), so I assumed that you just needed a couple of pointers in the right direction.

Try:
Code:
touch -t $(date +%Y%M%D0000) start_time_file
find directory_pathname -newer start_time_file

----------------
See correction in later post. The date format string is wrong.

Last edited by Don Cragun; 01-08-2015 at 11:02 PM.. Reason: Note mistake.
This User Gave Thanks to Don Cragun For This Post:
# 5  
Old 01-08-2015
Hiya Don,

Thanks for the help Smilie
# 6  
Old 01-08-2015
Oops. That date command should have used a different format string.

Try:
Code:
touch -t $(date +%Y%m%d0000) start_time_file
find directory_pathname -newer start_time_file

# 7  
Old 01-08-2015
Yeah I picked up on that, cheers!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Monitoring for specific date stamped files before and after midnight

Hi Guys, I am having a brain freeze.... I want to monitor a directory for a time stamped file on a sol 10 system in bash or ksh, the files will come in looking like this.. randomfile.DDMMYY.rpt The problem i am having is the file can come in before or after midnight, the file will... (5 Replies)
Discussion started by: twinion
5 Replies

2. Shell Programming and Scripting

current date modified file

Hi , In my directory , i have many days file but i want to see all those which are of todays date. i tried this but it gives all the files mtime -0 |ls -ltr I tried the below option as well. 19635 find -iname "*.LOG" -mtime 19636 ls -ltr *.LOG -mtime -1 19637 ls -ltr *.LOG... (7 Replies)
Discussion started by: guddu_12
7 Replies

3. Fedora

System Crashes at Midnight with Timer Expired 35 1048688 scs_op C8C521B0 Error, Any Idea's

We've been having issues for about a year, although thankfully they are in-frequent and randam. Meaning it happened a couple of times within a 3 month period, then stopped for a couple of months and then started again. It has happened twice now in the last month. At the stroke of midnight, ... (5 Replies)
Discussion started by: graybeard
5 Replies

4. UNIX for Dummies Questions & Answers

Find last modified date for many files

Hello all - I've looked and have not been able to find a "find" command that will list the last modified date of files within a specific directory and its subdirectories. If anyone knows of such a command it would be very much appreciated! If possible, I would like to sort this output and have... (5 Replies)
Discussion started by: MichaelH3947
5 Replies

5. UNIX for Dummies Questions & Answers

Ctrl-enter doesn't work when running Midnight Commander in xterm

When running MC in xterm or gnome-terminal, it doesn't seem to allow the use of Ctrl-enter and Ctr-shift-enter to copy marked files to the command line. Does anyone know of another way to cause this to happen or a way to enable it under xterm/gnome-term? With thanks, Narnie (0 Replies)
Discussion started by: Narnie
0 Replies

6. Shell Programming and Scripting

How to find a date which is 7 days past when given current date

hii all. I have to get the date of the 7th day past from the current date. if i give the current date as sep 3 then i must get the date as 27th of august. can we get the values from the "cal" command. cal | awk '{print $2}' will this type of command work. actually my need is if today is... (17 Replies)
Discussion started by: ladtony
17 Replies

7. Linux

system slowdown at midnight

Hi, My test server slows down at 12:00 midnight every day. I don't have any crons set. But I found that there are some system crons. Are they really important, can they cause any problem at 12 midnigh? # ls cron*.* cron.deny cron.d: sysstat cron.daily: 0anacron 0logwatch cups ... (2 Replies)
Discussion started by: shantanuo
2 Replies

8. Solaris

How to install Midnight Commander on Solaris 10

Hi, im very newb in Solaris. I have install So10. Now i just try install the first software Midnight Commander and fails. I just do as follow - i go to Sunfreeware - Freeware Open Source Software for Sun Microsystem's Solaris and get into x86-so10 link ( i use VM ware ) download these packages... (5 Replies)
Discussion started by: tien86
5 Replies

9. UNIX for Dummies Questions & Answers

how to find files less than the current date

Hai, i have one directory contains 100 files .each file name like xvb_dateformat.i want find which file names are xvb_lessthan or equal to currentdate. any one give the solution. regards (4 Replies)
Discussion started by: mallikarjuna
4 Replies
Login or Register to Ask a Question