Find the file created on current date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find the file created on current date
# 1  
Old 11-20-2014
Find the file created on current date

Hi All,

I'm trying to find a file which is created on current day.... I searched in unix.com and i found, below command.
Code:
find /land/ -mtime -1 -type f -print  | grep "FF_Member_STG.dat"

The command checks if the file with name "FF_Member_STG.dat" is created today then exit else proceed.

The problem with this command is, it takes last 24 hours (-mtime -1) and if i execute the process in 24 hours, it is not working as expected.

Can someone help me on what would be the solution?


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks
# 2  
Old 11-20-2014
In what way is it not working "as expected"? What, exactly, goes wrong?

You can narrow that down, and make it much faster, by searching in a folder inside /land/.
# 3  
Old 11-20-2014
Hi Corona688,

Let's say if i am executing the process on 11/20/2014 at 3:00 PM.

On next day (11/21), if i execute the same process on 11:00 AM, it will assume the file is of today (as it is yet to pass 24 hours) and it will come out from the process.

But if you see, the date has been changed. so even if process creates file on 23:58 and next time i run on 00:05, it should continue the process, rather than exiting it.
# 4  
Old 11-20-2014
Hi

Try inserting -daystart before -mtime -1:

Code:
find /land/ -daystart -mtime -1 -type f -print  | grep "FF_Member_STG.dat"

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies

2. UNIX for Dummies Questions & Answers

Find the count of files by last created date based on the given date range

My unix version is IBM AIX Version 6.1 I tried google my requirement and found the below answer, find . -newermt “2012-06-15 08:13" ! -newermt “2012-06-15 18:20" But newer command is not working in AIX version 6.1 unix I have given my requirement below: Input: atr files: ... (1 Reply)
Discussion started by: yuvaa27
1 Replies

3. Shell Programming and Scripting

Find big file include current date

Hi, I want to put script. The script is to show file that larger than 100MB include current date (eg: today date). After find the date, it will compress list file and split the tar.gz file. Any idea how to do that? This bash script will run auto everyday. It's will transfer will to other... (12 Replies)
Discussion started by: mzainal
12 Replies

4. AIX

How to find the date on which a particular directory is created?

how to find the date on which a particular directory is created? Thanks. (4 Replies)
Discussion started by: samsungsamsung
4 Replies

5. Shell Programming and Scripting

Find first created file date in YYYYMMDD format

Hi All, We are copying all the files into ARCHIVE directory after we process them. We are doing this process from last 2 years, now we have a lot of files in ARCHIVE directory. Now I need to find when the first file is copied into this directory? If I Issue, ls -l /ARCHIVE/*.* | tail -1... (3 Replies)
Discussion started by: Raamc
3 Replies

6. Shell Programming and Scripting

How to find the create time of a file if current date is in next month

Hi All, I want to find the time diffrence between currnt time and "abc.txt" file create time. I have solve that but if the abc.txt file created last month then is there any process to find the difftent? Exp: Create time of abc.txt is "Apr 14 06:48" and currect date is "May 17 23:47".... (1 Reply)
Discussion started by: priyankak
1 Replies

7. 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

8. UNIX for Dummies Questions & Answers

how to find folder size with created date

hi, please give me adivse .how to find the folder size with created created date . eg: i have directore and in that sub directoties and so on.. /home/mud/abc/dcb/ for this i want output like this path size date -------------------------------------------... (3 Replies)
Discussion started by: muddasani
3 Replies

9. Shell Programming and Scripting

Need to find created date of file in UNIX

I need to write a script which has to list all the files which are created before six months from now. kindly help on this ... (7 Replies)
Discussion started by: amirthraj_12
7 Replies

10. UNIX for Advanced & Expert Users

How to FTP all newly created but the current open file?

An application running on HP-UX constantly generates new text log files ( I think using logpipe ). Any new file created requires to be ftp'ed to an offline server, however I want to make sure that the current file being written should not be transferred. For examples consider the following files... (3 Replies)
Discussion started by: indianya
3 Replies
Login or Register to Ask a Question