Sponsored Content
Top Forums UNIX for Advanced & Expert Users how to find files older than 4hours in HP-UX Post 302147551 by jim mcnamara on Tuesday 27th of November 2007 12:56:58 PM
Old 11-27-2007
One way using perl:
Code:
#!/bin/ksh
filetime()
{
    perl  -e '
         $mtime = (stat $ARGV[0])[9];
          print $mtime;
         '  $1
}
now=$(date +%s)
now=$(( $now - 14400 ))
find /path/to/file -type f | \
while read filename 
do
     ftime=$(filetime $filename)
     if [[ $ftime -ge $now ]] ; then
        continue
     fi
     rm -f $file
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find files older than 20 days & not use find

I need to find files that have the ending of .out and that are older than 20 days. However, I cannot use find as I do not want to search in the directories that are underneath the directory that I am searching in. How can this be done?? Find returns files that I do not want. (2 Replies)
Discussion started by: halo98
2 Replies

2. Shell Programming and Scripting

only find files older than x minutes old

I am looking for a way to show files that have been created within a certain period (say anything older than 10 minutes or so). Is there a command/series of commands I can do this with? As an example, I have the following in a directory: -rw-r--r-- 1 owner group 70175 May 16 09:10... (1 Reply)
Discussion started by: dsimpg1
1 Replies

3. Shell Programming and Scripting

find files older than a given file

I want to find out the files that are older than a given file in the current directory ...Can anyone help (5 Replies)
Discussion started by: Shivdatta
5 Replies

4. AIX

how to find files older than 2 hours

I need help to find files in a directory that are older than 2 hours. Any help would be great. (3 Replies)
Discussion started by: pt14
3 Replies

5. UNIX Desktop Questions & Answers

Find files older than 10 days

What command arguments I can use in unix to list files older than 10 days in my current directory, but I don't want to list the hidden files. find . -type f -mtime +15 -print will work but, it is listing all the hidden files., which I don't want. (4 Replies)
Discussion started by: Pouchie1
4 Replies

6. Shell Programming and Scripting

find files older than and containing then tar.

I'm tring to: find files recursively older than x days that contain dat or DAT then tar them I can find the files older than 90 days containing dat with this: find . -mtime +90 -type f -name "*dat*" -exec tar -cvvfp /some/path/some.tar {} \; but how do I do it case insensitive? ... (3 Replies)
Discussion started by: Ikon
3 Replies

7. Shell Programming and Scripting

Find files older than 8 hours

I need a script to find files older than 8 hours... I know i can use mmin but the same is not working...the same only support mtime... This is the script i created..but the same is only giving 1 hour old..as I have given dt_H as 1 only...but if i give 8..it can go in -(negative)..how to get the... (5 Replies)
Discussion started by: cotton
5 Replies

8. UNIX for Dummies Questions & Answers

Find files older than 2010?

Hi, I need to delete all files, in a folder, older than 2010 that is 2009, 2008 ,.. files... Can anyone suggest the command for that,... Thanks ---------- Post updated at 03:29 PM ---------- Previous update was at 02:53 PM ---------- humm,.. ok right now I am using the following:... (4 Replies)
Discussion started by: Mack1982
4 Replies

9. UNIX for Advanced & Expert Users

find files older than 30 days old

Hello, I have a script which finds files in a directory that are older than 30 days and remove them. The problem is that these files are too many and when i run this command: find * -mtime +30 | xargs rm I run this command inside the directory and it returns the error: /usr/bin/find:... (8 Replies)
Discussion started by: omonoiatis9
8 Replies

10. Shell Programming and Scripting

Find older files than specified date

Hi, I need to find out list of files which are older than specific date. I am using 'find, and newer' commands but its not giving the correct result. Can you please help to findout the list of files. thanks (2 Replies)
Discussion started by: Satyak
2 Replies
CURLINFO_FILETIME(3)					     curl_easy_getinfo options					      CURLINFO_FILETIME(3)

NAME
CURLINFO_FILETIME - get the remote time of the retrieved document SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_FILETIME, long *timep); DESCRIPTION
Pass a pointer to a long to receive the remote time of the retrieved document (in number of seconds since 1 jan 1970 in the GMT/UTC time zone). If you get -1, it can be because of many reasons (it might be unknown, the server might hide it or the server doesn't support the command that tells document time etc) and the time of the document is unknown. Note that you must tell the server to collect this information before the transfer is made, by using the CURLOPT_FILETIME(3) option to curl_easy_setopt(3) or you will unconditionally get a -1 back. PROTOCOLS
HTTP(S), FTP(S), SFTP EXAMPLE
curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, url); /* Ask for filetime */ curl_easy_setopt(curl, CURLOPT_FILETIME, 1L); res = curl_easy_perform(curl); if(CURLE_OK == res) { res = curl_easy_getinfo(curl, CURLINFO_FILETIME, &filetime); if((CURLE_OK == res) && (filetime >= 0)) { time_t file_time = (time_t)filetime; printf("filetime %s: %s", filename, ctime(&file_time)); } } /* always cleanup */ curl_easy_cleanup(curl); } AVAILABILITY
Added in 7.5 RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. SEE ALSO
curl_easy_getinfo(3), curl_easy_setopt(3), libcurl 7.54.0 April 03, 2017 CURLINFO_FILETIME(3)
All times are GMT -4. The time now is 12:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy