---------- Post updated 06-15-10 at 12:14 PM ---------- Previous update was 06-14-10 at 04:20 PM ----------
Actually- there is an issue with this. The way in which the backup folders are created are like the following;
The '6' in this was easily fixed by simply removing the {2} that was after it. (the only issue that results from this is what to do starting in October, but I will just create a second script when that time comes)
What to do with the '9' and then '10' . I've tried various expressions and wildcards, but cannot seem to get it to work. I have a test directory setup with directories just as above. It seems that whatever I try, the directories that echo as the 'last on the list' are 6-10 & 6-11, rather than 6-9 & 6-10.
thanks in advance.
---------- Post updated at 03:21 PM ---------- Previous update was at 12:14 PM ----------
I've actually have changed the list command to the following and it works. However, because of the digit placement of the 9 and the 10, the 9 is seen as the first digit, which messes up the sort command. This is an issue that I will need to resolve elsewhere.
My change;
Last edited by Scott; 06-15-2010 at 08:27 PM..
Reason: Code tags, please...
I have been working on a script to list all the name's of a subfolder in a text file then edit that text file and then delete the subfolder base on the edited text file so far I have been able to do every thing I just talked about but can't figure out how to delete the subfolers base on a text file... (8 Replies)
Hi,
I am trying to write a shell script to delete logs generate by db when space in the folder reaches 70%. i am getting space values from db, find the files at OS and remove them by using a cron job runs every 5minutes.
I have to keep the latest 5 files at any time, my problem is that log files... (3 Replies)
Hi ,
I need a script which basically deltes all files in folder a which are alreasy present in folder b
say folder a has files abc.txt
pqr .txt
and b has abc.txt
pqr.txt
rmr.txt
then file abc.txt and pqr.txt from a should be deleted (6 Replies)
hi
can any one help me in shell scripting
where in my requirement is to
write a shell script where in if i run that script i should copy all the .doc files from one system to another systems within a network like from parent folders to child folder
example
parent folder A within parent folder... (5 Replies)
Hi Experts,
i need a little help.
i have different folder that contain files that need to be deleted. but those folder contains huge amoung of same with 3 different extention.
what i used to do is to delete them using the rm commande
rm *.ext *.ext1 *.ext3
what i want to do is to have... (1 Reply)
hi i need a script to delete the files older than 2 days...
if my input is say in a folder versions
A_14122012.txt
A_15122012.txt
A_16122012.txt
A_17122012.txt
i want my output to be
A_16122012.txt
A_17122012.txt
thanks in advance
hemanth saikumar. (2 Replies)
Hi,
I currently use a script to extract *.deb files located in a Directory called
"/var/mobile/Media/Downloads"
The Problem is howver I want the script to ignore the folder:
"/var/mobile/Media/Downloads/New Debs and Files"
(it shall NOT decompile any of the files in that folder.
Here is... (2 Replies)
I am trying to copy files with specific date and name to another folder. I am very new to shell scripting so i am finding it hard to do that. see the sample code i have written below.
srcdir="/media/ubuntu/CA52057F5205720D/Users/st4r8_000/Desktop/office work/26 nov"... (13 Replies)
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
Hi,
I have a script doing backup to synology server, the script create new folder each day with the date as being folder name i.e. 2018-07-30. Just before creating the new folder I want the script to find the oldest folder from the list and delete it including its content.
for example... (3 Replies)
Discussion started by: humble_learner
3 Replies
LEARN ABOUT DEBIAN
tmpwatch
TMPWATCH(8) System Administrator's Manual TMPWATCH(8)NAME
tmpwatch - removes files which haven't been accessed for a period of time
SYNOPSIS
tmpwatch [-u|-m|-c] [-MUadfqstvx] [--verbose] [--force] [--all]
[--nodirs] [--nosymlinks] [--test] [--fuser] [--quiet]
[--atime|--mtime|--ctime] [--dirmtime] [--exclude path]
[--exclude-user user] time dirs
DESCRIPTION
tmpwatch recursively removes files which haven't been accessed for a given time. Normally, it's used to clean up directories which are
used for temporary holding space such as /tmp.
When changing directories, tmpwatch is very sensitive to possible race conditions and will exit with an error if one is detected. It does
not follow symbolic links in the directories it's cleaning (even if a symbolic link is given as its argument), will not switch filesystems,
skips lost+found directories owned by the root user, and only removes empty directories, regular files, and symbolic links.
By default, tmpwatch dates files by their atime (access time), not their mtime (modification time). If files aren't being removed when ls
-l implies they should be, use ls -u to examine their atime to see if that explains the problem.
If the --atime, --ctime or --mtime options are used in combination, the decision about deleting a file will be based on the maximum of
these times. The --dirmtime option implies ignoring atime of directories, even if the --atime option is used.
The time parameter defines the threshold for removing files. If the file has not been accessed for time, the file is removed. The time
argument is a number with an optional single-character suffix specifying the units: h for hours, d for days. If no suffix is specified,
time is in hours.
Following this, one or more directories may be given for tmpwatch to clean up.
OPTIONS -u, --atime
Make the decision about deleting a file based on the file's atime (access time). This is the default.
Note that the periodic updatedb file system scans keep the atime of directories recent.
-m, --mtime
Make the decision about deleting a file based on the file's mtime (modification time) instead of the atime.
-c, --ctime
Make the decision about deleting a file based on the file's ctime (inode change time) instead of the atime; for directories, make
the decision based on the mtime.
-M, --dirmtime
Make the decision about deleting a directory based on the directory's mtime (modification time) instead of the atime; completely
ignore atime for directories.
-a, --all
Remove all file types, not just regular files, symbolic links and directories.
-d, --nodirs
Do not attempt to remove directories, even if they are empty.
-f, --force
Remove files even if root doesn't have write access (akin to rm -f).
-l, --nosymlinks
Do not attempt to remove symbolic links.
-q, --quiet
Report only fatal errors.
-s, --fuser
Attempt to use the "fuser" command to see if a file is already open before removing it. Not enabled by default. Does help in some
circumstances, but not all. Dependent on fuser being installed in /sbin. Not supported on HP-UX or Solaris.
-t, --test
Don't remove files, but go through the motions of removing them. This implies -v.
-U, --exclude-user=user
Don't remove files owned by user, which can be an user name or numeric user ID.
-v, --verbose
Print a verbose display. Two levels of verboseness are available -- use this option twice to get the most verbose output.
-x, --exclude=path
Skip path; if path is a directory, all files contained in it are skipped too. If path does not exist, it must be an absolute path
that contains no symbolic links.
SEE ALSO cron(1), ls(1), rm(1), fuser(1)WARNINGS
GNU-style long options are not supported on HP-UX.
AUTHORS
Erik Troan <ewt@redhat.com>
Preston Brown <pbrown@redhat.com>
Nalin Dahyabhai <nalin@redhat.com>
Miloslav Trmac <mitr@redhat.com>
4th Berkeley Distribution Fri Dec 14 2007 TMPWATCH(8)