Sponsored Content
Top Forums Shell Programming and Scripting Move log files with date and delete older than 3 weeks Post 302804765 by vidyadhar85 on Thursday 9th of May 2013 06:27:36 AM
Old 05-09-2013
You can use below

Code:
 
mv usr/sbin/appl/tmp/logfile.txt  usr/sbin/appl/tmp/logfile_`date +"%d%b%y"`.txt
find usr/sbin/appl/tmp/logfile*.txt  -mtime +21 -exec rm {} \ ;

This User Gave Thanks to vidyadhar85 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to check whether the given file is 5 weeks older than current date

HI, I need to check whether the given file is 5 weeks older than current date ?? Can anyone give me the script for this ?? (1 Reply)
Discussion started by: risshanth
1 Replies

2. Shell Programming and Scripting

Delete files older than 3 months.(read date from the name of the file)

Guys, My log files stored in the date format format below(log_20080714072942): TIMESTAMP=`date +%Y%m%d%H%M%S` LOG=/log/log_${TIMESTAMP}.log I'm looking for a shell script which deletes all files which is older than 3 months from today. Regards, Bhagat (3 Replies)
Discussion started by: bhagat.singh-j
3 Replies

3. Shell Programming and Scripting

Delete the files older than 3 weeks in a particular directory.

Hi, Friends, I am writing a script to delete all the files which are there for more than 3 weeks. I have tried this : find /home/appl/backup -type f -mtime +21 -exec rm -f {} \; But i am not sure if it deletes only the files in specified directory or all the directorinies in the provieded... (3 Replies)
Discussion started by: rajsharma
3 Replies

4. Emergency UNIX and Linux Support

How to delete all the files which are more than 3 weeks old in a particular directory.Thnx in advanc

(12 Replies)
Discussion started by: rajsharma
12 Replies

5. Shell Programming and Scripting

Move file older date

hlow all i have folder with name like this 20110512 20110601 20110602 so i want move the last 1 day to other directory for example this date 20110602 so i want move folder older 1 day from this date 20110512 -----> this folder will move to other dir 20110601-----> this folder will move... (2 Replies)
Discussion started by: zvtral
2 Replies

6. UNIX for Dummies Questions & Answers

move files older than 2 days to another folder

Hi I am facing problem in using this command, mv `find /export/june/PURGEDATA*.txt -mtime +2 -exec ls {} \;` june/archive/ mv: Insufficient arguments (1) Usage: mv f1 f2 mv f1 ... fn d1 mv d1 d2 Thank you in advance (2 Replies)
Discussion started by: vishwakar
2 Replies

7. UNIX for Advanced & Expert Users

HPUX move files older than 30 days

Hello, I have a script which finds files in a directory that are older than 30 days and moves them to the specified directory. The problem is I don't know why it works the way it does? Code: find . -name '*.sql' ! -mtime -30 -exec mv '{}' /dataload/archivelogs \; I was under the... (4 Replies)
Discussion started by: pure_jax
4 Replies

8. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

9. UNIX for Dummies Questions & Answers

How to delete all the files older than a date?

Hi, I need a command for deleting all the compress files *.Z that are older than the current date - 5 days. Basically I have a directory where daily I meet some back up files and I want to remove automatically the ones 5 days (or more) older than the current date. How can I write a 'rm' command... (1 Reply)
Discussion started by: Francy
1 Replies

10. UNIX for Beginners Questions & Answers

How to move files older than certain time?

If there are 100 files created in a directory /data/ today from 2:00 AM to 10:00 AM I need to move files older than 3:00 AM to a new directory /hold/ How to do that? Also, if I have to move files between 3:00 AM to 9:00 AM, how to achieve that (3 Replies)
Discussion started by: eskay
3 Replies
files(4)						     Kernel Interfaces Manual							  files(4)

NAME
files - File control database (Enhanced Security) DESCRIPTION
The file control database (/etc/auth/system/files) is designed to help the Information System Security Officer (ISSO) maintain the integrity of the system. The database contains entries for system data files and executable files that require certain attributes. Some files require certain attributes to provide protection against unauthorized access, while others require a specific set of attributes to accomplish their intended function. The database is used by the library routine create_file_securely() to determine the set of attributes for a newly created file. Many pro- grams associated with the trusted computing base (TCB) use this library routine for file creation to ensure that file attributes are set correctly. A broad range of attributes can be specified in the file control database. Specific choices depend upon the exact system configuration. These choices are as follows: This field specifies the owner name for the entry. If an owner name is not specified and the entry is created using create_file_securely, the owner of the file will be the real user ID of the process creating the file. This field specifies the group name for the entry. If a group name is not specified and the entry is created using create_file_securely, the group of the file will be the real group ID of the process creating the file. This field specifies the mode word for the entry. If the mode word is not specified and create_file_securely is used to create the entry, a mode word of 0 (zero) is assigned to the new file. This field identifies the type of the entry. This field is not taken into account by create_file_securely when a file is being created. The library routine will only create regular files. Choices for the type field are as follows: Regular file Directory FIFO device (pipe) Character special device Block special device Socket EXAMPLES
The following example is a typical file control database entry for the program /sbin/newfs: /sbin/newfs:f_owner=root:f_group=bin: :f_type=r:f_mode#04111: :chkent: This entry specifies that the newfs program has bin as its owner and group, that it is a regular file, and that its mode is 0111 The following example shows an entry for a site-specific directory that contains help files for an application: /appl/help_files:f_owner=appadmin:f_group=appl: :f_type=d:f_mode#0750: :chkent; This entry specifies the owner of the /appl/help_files directory as appadmin, the group as appl, and the mode as 0750. FILES
Specifies the pathname of the file control database. RELATED INFORMATION
Functions: getprfient(3) Files: authcap(4) delim off files(4)
All times are GMT -4. The time now is 01:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy