Sponsored Content
Top Forums Shell Programming and Scripting Regarding deletion of old files Post 93930 by RTM on Friday 23rd of December 2005 08:27:10 AM
Old 12-23-2005
It works fine for me - ran on Fedora.

Code:
FIRST RUN - ONLY LOOKING FOR THE FILES (CHANGED | xargs rm -f to just -ls)
[tghunter@localhost ~]$ ./oldfiles
. is a directory on this machine
Time Limit:+1900
looking for files older than +1900 days to be deleted from .
387600    8 -rw-r--r--   1 tghunter tghunter     2048 Sep 19  2000 ./.openoffice.org2.0/user/gallery/sg100.sdv
older files are now deleted successfully

[tghunter@localhost ~]$ cp ./.openoffice.org2.0/user/gallery/sg100.sdv ./.openoffice.org2.0/user/gallery/sg100.sdvhog
[tghunter@localhost ~]$ ./oldfiles
. is a directory on this machine
Time Limit:+1900
looking for files older than +1900 days to be deleted from .
387600    8 -rw-r--r--   1 tghunter tghunter     2048 Sep 19  2000 ./.openoffice.org2.0/user/gallery/sg100.sdv
older files are now deleted successfully
CHANGED TO REMOVE FILES
[tghunter@localhost ~]$ vi oldfiles
[tghunter@localhost ~]$ ./oldfiles
. is a directory on this machine
Time Limit:+1900
looking for files older than +1900 days to be deleted from .
older files are now deleted successfully
[tghunter@localhost ~]$ ls ./.openoffice.org2.0/user/gallery/sg100.sdv
ls: ./.openoffice.org2.0/user/gallery/sg100.sdv: No such file or directory
[tghunter@localhost ~]$ ls ./.openoffice.org2.0/user/gallery/sg100.sdvhog
./.openoffice.org2.0/user/gallery/sg100.sdvhog
[tghunter@localhost ~]$ mv ./.openoffice.org2.0/user/gallery/sg100.sdvhog ./.openoffice.org2.0/user/gallery/sg100.sdv
[tghunter@localhost ~]$ cat param.txt
.    +1900

Check that your param.txt file is set up correctly and check your script by listing the files versus removing them to insure it will only get the files you really want to remove. (find $DIR -type f -mtime $TIME -ls )
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Deletion of log files.

We have log files dating back to 2004. I need to write an interative script that will request the user for how many months he needs to keep the log files and remove all the remaing log files after that month. Supposing we are now in June 2006 , if teh user request to keep log file for the last 3... (1 Reply)
Discussion started by: Geeta
1 Replies

2. Shell Programming and Scripting

Script for automatic deletion of old files

Hi, I have a folder with limited space. I do not have provisions to increase the space for this folder. So i have to delete files which are more than 1 month old automatically. But, i need to maintain the files created by 4 users and delete all the other files automatically which is more than 1... (4 Replies)
Discussion started by: vivek_scv
4 Replies

3. UNIX for Dummies Questions & Answers

conditional deletion of log files

i am a newbie and learning the ropes.........want to know how can i include a piece of code in a script (which redirects log files to a company standard out file) to delete the log files which are empty but should retain only those which has some process information in it......this should happen... (3 Replies)
Discussion started by: sonali007
3 Replies

4. Shell Programming and Scripting

Multiple Files deletion in perl

Hello Friends, I want to delete all the "*.trg" files in a directory but i don't want to do it by system("rm -r *.trg"); Can i do it thru unlink or by any other mean Thanks, Pulkit (1 Reply)
Discussion started by: pulkit
1 Replies

5. Shell Programming and Scripting

Fake deletion of files

Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these! I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from. drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37... (2 Replies)
Discussion started by: Peejay
2 Replies

6. Shell Programming and Scripting

Files Deletion After 20 Minutes

Hi, everyone. Could you help me with deletion of files, which are 20 minutes old. I found out how to make deletion for files in that way : find <dir> -mtime n -exec rm -rf "{}" Could you offer your suggestions. Many thanks in advance. (5 Replies)
Discussion started by: KReoN
5 Replies

7. UNIX for Dummies Questions & Answers

Periodical Deletion of files and folders

Hi All, how can Periodical Delete files and folders using shell script. I.e after 1 min i want to delete files and folderns from my home directory. Thanks, Arun (9 Replies)
Discussion started by: arun508.gatike
9 Replies

8. Shell Programming and Scripting

deletion of multiple occurring files

Hi all, In the given file, what I need to do is to select double (or triple) occurring files and delete the one having smaller file size. And would like to keep the one with the big file size. 518t-rw-r--r-- 1 emily us_cms 101348458 Oct 8 16:43 vgtree_518_0_LHB.root 518t-rw-r--r-- 1... (9 Replies)
Discussion started by: emily
9 Replies

9. Debian

Problem with files/dirs deletion

Hi, The other day i installed a PHP based CMS (modx) on my shell account and noticed that i couldn't delete any of files/dirs it created after. Also, i noticed that all that stuff is owned by username-www instead of username. I tried chown, chmod and using a PHP script to do the same wti... (4 Replies)
Discussion started by: pentago
4 Replies

10. Shell Programming and Scripting

Three month old specific files deletion

Hi, I need to delete 3 month old files in my logpath. This path contains several logs and other important files The file names are be like this sl_details.env tomcatfiles_03062014.log application_zur_03.062014.log I need to delete only tomcatfiles logs. I wrote this command. can... (7 Replies)
Discussion started by: nag_sathi
7 Replies
DH_COMPRESS(1)							     Debhelper							    DH_COMPRESS(1)

NAME
dh_compress - compress files and fix symlinks in package build directories SYNOPSIS
dh_compress [debhelperoptions] [-Xitem] [-A] [file...] DESCRIPTION
dh_compress is a debhelper program that is responsible for compressing the files in package build directories, and makes sure that any symlinks that pointed to the files before they were compressed are updated to point to the new files. By default, dh_compress compresses files that Debian policy mandates should be compressed, namely all files in usr/share/info, usr/share/man, files in usr/share/doc that are larger than 4k in size, (except the copyright file, .html and other web files, image files, and files that appear to be already compressed based on their extensions), and all changelog files. Plus PCF fonts underneath usr/share/fonts/X11/ FILES
debian/package.compress These files are deprecated. If this file exists, the default files are not compressed. Instead, the file is ran as a shell script, and all filenames that the shell script outputs will be compressed. The shell script will be run from inside the package build directory. Note though that using -X is a much better idea in general; you should only use a debian/package.compress file if you really need to. OPTIONS
-Xitem, --exclude=item Exclude files that contain item anywhere in their filename from being compressed. For example, -X.tiff will exclude TIFF files from compression. You may use this option multiple times to build up a list of things to exclude. -A, --all Compress all files specified by command line parameters in ALL packages acted on. file ... Add these files to the list of files to compress. CONFORMS TO
Debian policy, version 3.0 SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Joey Hess <joeyh@debian.org> 8.9.0ubuntu2.1 2012-06-12 DH_COMPRESS(1)
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy