Find command output gives one day before time stamp


 
Thread Tools Search this Thread
Operating Systems Solaris Find command output gives one day before time stamp
# 8  
Old 10-05-2012
What are you saying? The timestamp being created is four hours ahead when you really need it four hours behind? Is that it?
# 9  
Old 10-05-2012
Quote:
Originally Posted by hicksd8
What are you saying? The timestamp being created is four hours ahead when you really need it four hours behind? Is that it?
The reference 4 hours old file was created in the /path/ as expected. i.e) four hours b4 from now.

but when u use the ls -l <timestamp file>

output is showing as created with sterday date and time. i.e oct 4th

Got it?

---------- Post updated at 04:48 AM ---------- Previous update was at 04:45 AM ----------

Quote:
Originally Posted by velava
The reference 4 hours old file was created in the /path/ as expected. i.e) four hours b4 from now.

but when u use the ls -l <timestamp file>

output is showing as created with sterday date and time. i.e oct 4th

Got it?

Also, please try this without the space between the bang and -newer.

getting the below error when I trying the above,

find: bad option !-newer
find: [-H | -L] path-list predicate-list
# 10  
Old 10-05-2012
I think I understand.............

As I said previously, the find command is using the inode date/time, that is what is shown by

Code:
 
ls -l <timestamp file>

If that date/time is wrong then that explains why find is giving you the wrong output.

You need to test your timestamp creation script by running it and immediately looking at it with ls -l

The date/time shown needs to be four hours ago. If it is not, then your script is faulty. I can't see anything wrong with your script but others on this forum are expert coders and will tell you what's wrong, I'm sure of that.
# 11  
Old 10-05-2012
Quote:
Originally Posted by hicksd8
I think I understand.............

As I said previously, the find command is using the inode date/time, that is what is shown by

Code:
 
ls -l <timestamp file>

If that date/time is wrong then that explains why find is giving you the wrong output.

You need to test your timestamp creation script by running it and immediately looking at it with ls -l

The date/time shown needs to be four hours ago. If it is not, then your script is faulty. I can't see anything wrong with your script but others on this forum are expert coders and will tell you what's wrong, I'm sure of that.

Thanks!

/usr/bin/perl -le 'print scalar localtime (time() - 240*60);' - it is returning Thu Oct 4 23:17:59 2012

it is not correct.
# 12  
Old 10-05-2012
I guess that's a little progress.

I'm not a Perl person so can't help with that.

Post if you fix it otherwise I'm sure others will chip in.
# 13  
Old 10-05-2012
Quote:
Originally Posted by velava
Code:
find /path/ -type f ! -newer 4_hours_oledr_file -exec ls -lrt {} \;

Your timestamp issues aside, since ls is always called with a single file argument, the -r and -t options have no effect. If you get the correct sort, it's because find happend to visit the files in that order.

Regards,
Alister
# 14  
Old 10-05-2012
This should be better (while not perfect):
Code:
find /path/ -type f ! -newer 4_hours_older_file -exec ls -lrt {} +

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Diplay current time stamp in the output

I want to display the command output in a particular format. can you please suggest how can i do this Output of the command Name= XYZ Company= Alpha Department= Accounts Country= Singapore Name=MNC Company= Beta Department= Engineering country=Malta Name=ABC Company=Gamma... (2 Replies)
Discussion started by: swets
2 Replies

2. Shell Programming and Scripting

How do i find a file with the current time stamp in it??

I want to find a file using find or any utility having the current date time stamp..... I have an alternate way to do that.... but that is too way out of logic... so looking out something with find itself (5 Replies)
Discussion started by: nikhil jain
5 Replies

3. Shell Programming and Scripting

How to change time stamp with touch command?

Hi, I wish to change time stamp of a directory with all its subdirectories and files on server. I am able to find following two ways but want to know which will be the better one. I have not tried anyone of them because I am not sure if it can effect my data: find * -type d -exec touch... (5 Replies)
Discussion started by: bioinfo
5 Replies

4. Solaris

System time and Cron time stamp not matching

On Solaris 10 server the system date won't match with the timestamp on files created by a cron jobs, Please help here is what i get when i check for system date infodba-ie10ux014:/tcpdv1_ie10/tcadmin/bin\n\r-> date Tue Apr 24 15:27:43 GMT 2012at same time i executed a cron job, and checked... (4 Replies)
Discussion started by: karghum
4 Replies

5. Shell Programming and Scripting

How to get time duration between two human readable time stamp in Unix?

Here is two time I have: Jul 12 16:02:01 Jul 13 01:02:01 and how can I do a simple match to get difference between two time which is 09:00:00 Thanks in advance. (3 Replies)
Discussion started by: ford99
3 Replies

6. Shell Programming and Scripting

regarding time stamp

hi everyone i am facing a strange problem here suppose content of my file is a=1,2,3 b=2,3,4 c=4,5,6 time= now the problem is i want to add value in front of time variable and the value should be i format only "HHMMSS" so it should be like this a=1,2,3 b=2,3,4 c=4,5,6... (3 Replies)
Discussion started by: aishsimplesweet
3 Replies

7. Shell Programming and Scripting

Script to find previous month last day minus one day timestamp

Hi All, I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this. My Requirment is as below: Input for me will be 2000909(YYYYMM) I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies

8. Shell Programming and Scripting

greping with time stamp

Hi all, I want to grep a file name with time stamp as 30 minutes how can i??. Ex I will getting outputs in a file every minutes I want to grep it by a time intervals of 30 and show it . Any help will be great ! Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. UNIX for Advanced & Expert Users

output of the time command ?

can someone tell me the meaning of this commnad, If you want to see a grand total of CPU time for a program when it finishes running, you can use the time command. At the Unix prompt, enter: time java myprog Replace myprog with the name of the program you are running. The following is an... (2 Replies)
Discussion started by: ldpathak
2 Replies

10. Shell Programming and Scripting

Write a shell script to find whether the first day of the month is a working day

Hi , I am relatively new to unix... Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell.. This is very urgent. Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies
Login or Register to Ask a Question