Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting files created before two days ago Post 15371 by Jimbo on Wednesday 13th of February 2002 11:32:56 AM
Old 02-13-2002
Following command will find and list files older than 2 days from right now, not on clean calendar day divisions, and of course it also searches subdirectories:

find mydir -type f -mtime +2 -exec ls -ld {} \;

To remove them, change the ls -ld to rm -f

(Sorry knarayan, you covered it well, but your reply was not there when I started my reply)
Jimbo
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

command unix to list all files created since n month ago

Hello, I want to list all files that were created since 3 month ago. it exist a unix command to do it ? thank you (8 Replies)
Discussion started by: yacsil
8 Replies

2. Shell Programming and Scripting

Need to process files created an hour ago

Hello all, I would like to ask for an advice on how to deal with the following scenario. Every now and then, our ERP system creates an interface text file with the following file format - XORD????.DLD where ???? is a sequence number. We can have 1 or more XORD files created in an hour. ... (9 Replies)
Discussion started by: negixx
9 Replies

3. UNIX for Dummies Questions & Answers

deleting files with dates 3 months ago

please help me with this????? :confused: :confused: i need to create a program that will run in unix that will delete all files in a given directory that is at least 3 months old. first the program will need to automatically know what date it is right now to determine the files it will... (3 Replies)
Discussion started by: godalle
3 Replies

4. UNIX for Dummies Questions & Answers

file was created before 15 days ago.

How can I get difference date between today and 15 days ago and all filename is was created before 15 days ago? It has to be korn shell script. Thanks. (1 Reply)
Discussion started by: YoungBlood
1 Replies

5. Shell Programming and Scripting

List files created before Noon 2 days prior

Our nightly updates run in the evening and finish around 8am. My boss wants the current log files kept on the server for 2 days, but wants anything created before noon, 2 days prior archived. I was thinking of using touch to set a temporary file with a date of today-2 and a time of noon, then... (3 Replies)
Discussion started by: prismtx
3 Replies

6. Shell Programming and Scripting

Remove files which created date before 10 days on HP-UX

Hi All, Could you please let me know if there is any one can help to create a shell script to remove some files which is the created date for them greate than 10 days (sysdate-10) Please try to email me on email removed Thanks in advance, Murad (1 Reply)
Discussion started by: murad_fayez
1 Replies

7. UNIX for Dummies Questions & Answers

How to find files created some days before?

HI, I have 2 questions. 1> Is there any code to see files that created some day or some time before in a directory??? 2> how or where i will find the last exit status of a process?? thanks (6 Replies)
Discussion started by: jyotidas
6 Replies

8. Shell Programming and Scripting

Find unix file created how many days ago?

i want to find unix file created how many days ago? (4 Replies)
Discussion started by: utoptas
4 Replies

9. Shell Programming and Scripting

Find the sum of files created 5 days before

Hi, I want to find the sum of all the files created 5 days ago and store it in a variable. (os is HP-UX) can this be extracted from ls -l Is there any other way of getting the sum of all the files created (4 Replies)
Discussion started by: bang_dba
4 Replies

10. UNIX for Beginners Questions & Answers

How to find a file that's modified more than 2 days ago but less than 5 days ago?

How to find a file that's modified more than 2 days ago but was modified less than 5 days ago by use of any Linux utility ? (4 Replies)
Discussion started by: abdulbadii
4 Replies
CALENDAR(1)						    BSD General Commands Manual 					       CALENDAR(1)

NAME
calendar -- reminder service SYNOPSIS
calendar [-ax] [-d MMDD[[YY]YY]] [-f file] [-l days] [-w days] DESCRIPTION
The calendar utility processes text files and displays lines that match certain dates. The following options are available: -a Process the ``calendar'' files of all users and mail the results to them. This requires super-user privileges. -d MMDD[[YY]YY] Display lines for the given date. By default, the current date is used. The year, which may be given in either two or four digit format, is used only for purposes of determining whether the given date falls on a Friday in that year (see below). If the year is not specified, the current year is assumed. -f file Display matching calendar files from the given filename. By default, the following filenames are checked for: ~/calendar ~/.calendar /etc/calendar and the first which is found is used. The filename may be absolute. If not absolute, it is taken relative to the directory speci- fied by the CALENDAR_DIR environment variable, if set; otherwise, it is taken relative to the user's home directory. Or, if the -a flag is given, a non-absolute filename is taken relative to each user's home directory in turn. -l days Causes the program to ``look ahead'' a given number of days (default one) from the specified date and display their entries as well. -w days Causes the program to add the specified number of days to the ``look ahead'' number if and only if the day specified is a Friday. The default value is two, which causes calendar to print entries through the weekend on Fridays. -x Causes calendar not to set the CPP_RESTRICTED environment variable. Passing this flag allows users the (somewhat obscure) option of including a named pipe via cpp(1)'s #include syntax, but opens up the possibility of calendar hanging indefinitely if users do so incorrectly. For this reason, the -x flag should never be used with calendar -a. Lines should begin with a month and day. They may be entered in almost any format, either numeric or as character strings. A single aster- isk ('*') matches every month, or every day if a month has been provided. This means that two asterisks ('**') matches every day of the year, and is thus useful for ToDo tasks. A day without a month matches that day of every week. A month without a day matches the first of that month. Two numbers default to the month followed by the day. Lines with leading tabs default to the last entered date, allowing multi- ple line specifications for a single date. By convention, dates followed by an asterisk are not fixed, i.e., change from year to year. The ``calendar'' file is preprocessed by cpp(1), allowing the inclusion of shared files such as company holidays or meetings. If the shared file is not referenced by a full pathname, cpp(1) searches in the current (or home) directory first, and then in the directory /usr/share/calendar. Empty lines and lines protected by the C commenting syntax (/* ... */) are ignored. Some possible calendar entries: #include <calendar.usholiday> #include <calendar.birthday> 6/15 ... June 15 (if ambiguous, will default to month/day). Jun. 15 ... June 15. 15 June ... June 15. Thursday ... Every Thursday. June ... Every June 1st. 15 * ... 15th of every month. *15 ... 15th of every month. June* ... Every day of June. ** ... Every day FILES
The following default calendar files are provided: calendar.birthday Births and deaths of famous (and not-so-famous) people. calendar.christian Christian holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.computer Days of special significance to computer people. calendar.history Everything else, mostly U.S. historical events. calendar.holiday Other holidays, including the not-well-known, obscure, and really obscure. calendar.judaic Jewish holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. calendar.lotr Important dates in the Lord of the Rings series. calendar.music Musical events, births, and deaths. Strongly oriented toward rock 'n' roll. calendar.netbsd Important dates in the history of the NetBSD project. Mostly releases and port additions. calendar.usholiday U.S. holidays. This calendar should be updated yearly by the local system administrator so that roving holidays are set correctly for the current year. COMPATIBILITY
The calendar program previously selected lines which had the correct date anywhere in the line. This is no longer true, the date is only recognized when it occurs first on the line. In NetBSD 3.0, the calendar command was modified to search the user's home directory instead of the current directory by default. Users desiring the historical behavior should set the CALENDAR_DIR environment variable to ., or use the -f flag. SEE ALSO
at(1), cpp(1), cron(8) HISTORY
A calendar command appeared in Version 7 AT&T UNIX. BUGS
calendar doesn't handle events that move around from year to year, i.e., ``the last Monday in April''. The -a option ignores the user's CALENDAR_DIR environment variable. BSD
August 27, 2009 BSD
All times are GMT -4. The time now is 08:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy