Sponsored Content
Top Forums Shell Programming and Scripting rm files older then 2 seconds? Post 302370451 by mkastin on Wednesday 11th of November 2009 12:12:08 PM
Old 11-11-2009
Code:
for file in `ls -ltr --time-style=+%s | awk '{now=systime(); del_time=now-2; if($6<del_time && $5=="0") print $7}'` ;do
  chmod 777 $file >/dev/null 2>&1
  rm -f $file >/dev/null 2>&1
done


Last edited by mkastin; 11-11-2009 at 01:17 PM.. Reason: forgot the bytes=0 condition
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

files older than 15 minutes

Hi Friends, i have to write a script to raise a flag if there are any files that are older than 15 minutes in the directory.The directory is supplied as the parameter to the script. please help with a sample script. Thanks in advance veera (0 Replies)
Discussion started by: sveera
0 Replies

2. UNIX for Dummies Questions & Answers

rm files older than ...

Hello, How can I remove files older than yesterday or the day before or a given day ... Thank you in advance (2 Replies)
Discussion started by: annemar
2 Replies

3. UNIX for Dummies Questions & Answers

Remove the older files

Hi All, I need to remove some old files which the file creation date is older than a week. I've tried to use command: find . -atime +6 -exec rm{}. but it seems the creation date of files shown above were not as I expected. please your kind advice. Thanks. (1 Reply)
Discussion started by: Prasandha
1 Replies

4. Shell Programming and Scripting

Getting list of files generated last 10 seconds

I was trying to figure out in Korn shell but this may apply elsewhere how to generate a list of files from a directory created in the last 10 seconds or less. I have used the find command in the past with -mtime which is measured in days to get a list of files older than say 7 days for example. ... (1 Reply)
Discussion started by: lee_murray
1 Replies

5. Shell Programming and Scripting

files older than few hours

Hi All I need to know the command which can be used to list the files which are 3 hours old so that it can be deleted. (3 Replies)
Discussion started by: mskalyani9
3 Replies

6. Shell Programming and Scripting

files older than a certain time

I know how to find files, which are newer than a specific time. touch -t 201103300650 dummy find /path/to/files -type f -newer dummy -exec ls -l {} \; Is there a way to find files, which are older than a specific time? (2 Replies)
Discussion started by: BeefStu
2 Replies

7. Shell Programming and Scripting

how to delete the older files other than the recently added 5 files

Number of files will get created in a folder automatically daily.. so i hav to delete the older files other than the recently added 5 files.. Could u help me through this..?? (5 Replies)
Discussion started by: shaal89
5 Replies

8. Shell Programming and Scripting

Archiving older files

Hello Group, I would request your help to build a shell script in order to find files older than 90 days then create the same directory structure under the second disk (/archive directory) and move the file preserving the same timestamps (ownership, etc). Also keep the log of files moved... (4 Replies)
Discussion started by: csierra
4 Replies

9. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

10. AIX

Getting files through find command and listing file modification time upto seconds

I have to list the files of particular directory using file filter like find -name abc* something and if multiple file exist I also want time of each file up to seconds. Currently we are getting time up to minutes in AIX is there any way I can get file last modification time up to seconds. (4 Replies)
Discussion started by: Nitesh sahu
4 Replies
sg_get_page_stats(3)					     Library Functions Manual					      sg_get_page_stats(3)

NAME
sg_get_page_stats, sg_get_page_stats_diff - get paging statistics SYNOPSIS
#include <statgrab.h> sg_page_stats *sg_get_page_stats(void); sg_page_stats *sg_get_page_stats_diff(void); DESCRIPTION
sg_get_page_stats and sg_get_page_stats_diff both return a pointer to a static buffer of type sg_page_stats. sg_get_page_stats will return the number of pages the system has paged in and out since bootup. sg_get_page_stats_diff will return the difference since last time it was called. If it has not been called before, it will return sg_get_page_stats. RETURN VALUES
typedef struct{ long long pages_pagein; long long pages_pageout; time_t systime; }sg_page_stats; pages_pagein The number of pages swapped into memory. pages_pageout The number of pages swapped out of memory (to swap). systime The time period over which pages_pagein and pages_pageout were transferred. BUGS
Solaris doesn't seem to report accurately. It reports the number of pages swapped into memory, not necessarily from swap. This feature isn't deemed entirely reliable. SEE ALSO
statgrab(3) WEBSITE
http://www.i-scream.org/libstatgrab/ i-scream $Date: 2005/04/25 11:25:45 $ sg_get_page_stats(3)
All times are GMT -4. The time now is 04:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy