Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Deleting certain files over 30 days old Post 302090554 by Corona688 on Tuesday 26th of September 2006 11:25:32 AM
Old 09-26-2006
What I would do is have a list of files, maybye keep it in /etc/purge, formatted like this:

Code:
hac???_runnumber.lis

Then use a script like this:
Code:
#!/bin/sh

while read FILENAME
do
    rm -f /path/to/${FILENAME}
done < /etc/purge

This will not work if there is an enormous number of files, however.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deleting files created before two days ago

Dear All: I want to build a shell that delete files created two or more days ago ... I think it could be built using a special command with ls or grep, I'd apreciate any help from you guys I have a lot of log files from november, december, january and this tool will help me a lot The files... (3 Replies)
Discussion started by: josecollantes
3 Replies

2. Shell Programming and Scripting

Deleting files over 7 days old

Simple question I am sure - but one that I dont know the answer to nevertheless.. I have a directory that I store log files in - but I wish to run a daily script in cron to delete all files in this directory that have not been modified within the last 7 days... Can anyone help me? (10 Replies)
Discussion started by: frustrated1
10 Replies

3. Shell Programming and Scripting

Deleting specific files greater then 90 days

I have a directory that contains a number of history files for a process. Every file starts with the string "EVACK". FOr example EVACK0101.000001 EVACK0102.095940 EVACKmmdd.hhmiss I want to erase in the specific directory ONLY(no sub-directories) all EVACK files older then 90 days. I... (2 Replies)
Discussion started by: beilstwh
2 Replies

4. Shell Programming and Scripting

Deleting / finding files older than X days missess a day

Hi When trying to find and delete files which are, say, 1 day, the find command misses a day. Please refer the following example. xxxd$ find . -type f -ctime +1 -exec ls -ltr {} \; total 64 -rw-rw-r-- 1 oracle xxxd 81 Apr 30 11:25 ./ful_cfg_tmp_20080429_7.dat -rw-rw-r-- 1... (4 Replies)
Discussion started by: guruparan18
4 Replies

5. Shell Programming and Scripting

Script for deleting 30 days older

Hi, I need a script to delete files that are 30 days older and also the file name should contain aa or ab or ac as substring... Regards, Dolly.... (3 Replies)
Discussion started by: moon_friend
3 Replies

6. Shell Programming and Scripting

Deleting files older than 7 days

Hi Guys, I want to delete folder/files older than 7 days. Im using the command below. find /test/test1 -mtime +7 -print0 | xargs -0 rm -Rf /test/test1/* which works ok, but it deletes the test1 folder as well which i dont want. The test1 folder will have a list of sub-folders which in... (4 Replies)
Discussion started by: shezam
4 Replies

7. UNIX for Dummies Questions & Answers

Deleting specfic files older than N days

Hello, I am trying to delete specific files older than 7 days that start with FSTRnnnn (nnnn=sequnce number) from /home/users/userdir I.E cd home/users/userdir ll FSTR0001 Jul 8 14:20 FSTR0002 Jul 6 12:01 FSTR0003 May 25 09:45 FSTR0004 April 2 17:20 MSTR0034 Jul 6 12:45... (3 Replies)
Discussion started by: eurouno
3 Replies

8. Shell Programming and Scripting

deleting files older than 7 days

Hi Guys, I am new to unix I am looking for a script to delete files older than 7 days but i also want to exclude certain directories (like arch,log .....) and also some files with extensions ( like .ksh, .ch, ..............) Thanks (1 Reply)
Discussion started by: MAYAMAYA0451
1 Replies

9. AIX

Deleting files older than 14 days automatically

Hi In my aix server under the location "/usr/sap/SAPXI/extract", I have a lot of log files. I need a script which is to be added in crontab so that the files and directories older than 14 days should get deleted automatically from the location "/usr/sap/SAPXI/extract". Please advise me.... (3 Replies)
Discussion started by: samsungsamsung
3 Replies

10. UNIX for Dummies Questions & Answers

Script for Deleting files older than 14 days automatically

we need to have periodic clean up implemented in our sap directory \\sapds\PR1\int\scm\snp\outbound\snapshot. which needs unix script for Deleting files older than 14 days automatically in sap system unix os. (1 Reply)
Discussion started by: kvkreddy_b2w
1 Replies
UCFR(1) 						      Debian GNU/Linux manual							   UCFR(1)

NAME
       ucfr - Update Configuration File Registry:  associate packages with configuration files

SYNOPSIS
       ucfr [options] <Package> <Path to configuration file>

DESCRIPTION
       Where  Package is the package associated with the configuration file (and, in some sense, its owner), and Path to configuration file is the
       full path to the location (usually under /etc) where the configuration file lives, and is potentially modified by the end user. Please note
       that  usually  this means that we register actual files, and not symbolic links to files.  ucfr will follow symbolic links and register the
       real file,  and not the symbolic link.

       This script maintains an association between configuration files and packages, and is meant to help provide facilities that  dpkg  provides
       conffiles  for  configuration files and not shipped in a Debian package, but handled by the postinst by ucf instead. This script is idempo-
       tent, associating a package to a file multiple times is not an error.  It is normally an error to try to associate a file which is  already
       associated with another package, but this can be overridden by using the --force option.

OPTIONS
       -h, --help
	      Print a short usage message

       -n, --no-action
	      Dry run. Print the actions that would be taken if the script is invoked, but take no action.

       -d [n], --debug [n]
	      Set the debug level to the (optional) level n (n defaults to 1). This turns on copious debugging information.

       -p, --purge
	      Removes all vestiges of the association between the named package and the configuration file from the registry. The association must
	      already exist; if the configuration file is associated with some other package, an error happens, unless the option --force is  also
	      given.  In that case, the any associations for the configuration file are removed from the registry, whether or not the package name
	      matches. This action is idempotent, asking for an association to be purged multiple  times  does	not  result  in  an  error,  since
	      attempting  to  remove  an  non-existent	association is silently ignored unless the --verbose option is used (in which case it just
	      issues a diagnostic).

       -v, --verbose
	      Make the script be very verbose about setting internal variables.

       -f, --force
	      This option forces operations requested even if the configuration file in consideration is owned by another package. This  allows  a
	      package  to hijack a configuration file from another package, or to purge the association between the file and some other package in
	      the registry.

       --state-dir /path/to/dir
	      Set the state directory to /path/to/dir instead of the default /var/lib/ucf.  Used mostly for testing.

USAGE
       The most common case usage is pretty simple: a single line invocation in the postinst on configure, and another single line in  the  postrm
       to tell ucfr to forget about the association with the configuration file on purge (using the  --purge option) is all that is needed (assum-
       ing ucfr is still on the system).

FILES
       /var/lib/ucf/registry, and /var/lib/ucf/registry.X, where X is a small integer, where previous versions of the registry are stored.

       /etc/ucf.conf

EXAMPLES
       If the package foo wants to use ucfr to associate itself with a configuration file foo.conf, a simple invocation of ucfr  in  the  postinst
       file is all that is needed:

       ucfr foo /etc/foo.conf

       On purge, one should tell ucf to forget about the file (see detailed examples in /usr/share/doc/ucf/examples):

       ucfr --purge foo /etc/foo.conf

       If you want to remove all the conf files for a given package foo, the simplest way is to use ucfq.  For example

       ucfq -w foo | cut -d : -f 1 | while read cfile ; do ucfr -v $cfile ; done

SEE ALSO
       ucf(1), ucf.conf(5).

AUTHOR
       This manual page was written Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system.

Debian								    Feb 16 2018 							   UCFR(1)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy