Here is an example of code that will delete directories and their contents older than 2 weeks.
-type d says that you are deleting a directory and piping that to xargs with rm -rfv
means to force delete anything in the directory.
Code:
find /path/to/directory/directory_prefix_* -mtime +14 -type d | xargs rm -rfv
that code delete files or direct sub too?
friend in the directory have the attached file photo, without em, I Bargo the code below does not bring anything when I run
Code:
-rw-r--r-- 1 satverpv desa 2912 oct 24 17:38 1000169320160930.RSAT
-rw-r--r-- 1 satverpv desa 390936 oct 25 11:39 1000169320160921.RSAT
-rw-r--r-- 1 satverpv desa 0 oct 25 11:41 1000169320160928.RSAT
-rw-r--r-- 1 satverpv desa 390936 oct 25 12:34 1000169320160929.RSAT
-rw-r--r-- 1 satverpv desa 0 oct 26 16:27 1000169320160101.RSAT
-rw-r--r-- 1 satverpv desa 390936 oct 27 16:37 1000169320160922.RSAT
-rw-r--r-- 1 satverpv desa 0 oct 28 11:49 1000169320160927.RSAT
-rw-r--r-- 1 satverpv desa 396032 oct 28 12:24 1000169320161025.RSAT
satverpv(satdes) /u01/home/desa/satverpv/sat/dat> find /u01/home/desa/satverpv/sat/dat/*.RSAT -mtime +14 -type d
Last edited by tricampeon81; 11-02-2016 at 11:34 AM..
I'd like to delete ALL files on a daily basis within a directory that are over a day old. Anyone know how I can automate this through Cron as I have 146 websites to administer.
I've tried...
30 02 * * * /home/myspace/tmp/webalizer -atime + 1\! -type d -exec rm -f {} \;
but all i get is an... (1 Reply)
Hi Team,
I am new to scripting. I want to create a script, which needs to keep only 5 days directories and want to remove the old directory from a particular directory. Can Somebody help me with starting this script.
All my directories will be created in the name <YYYYMMDD>.
Thanks... (2 Replies)
I have a subdirectory which has many child directories and files in it. How can i delete them through a list (txt, rtf. xls , or any file extension) which is created by me. I can not manual delete one by one because it almost over 300 directory and over 4000 files. Any one know please help me? (5 Replies)
Hello,
I have several files in a specific directory.
A specific string in one file can occur in another files.
If this string is in other files. Then all the files in which this string occured should be deleted and only 1 file should remain with the string.
Example.
file1
ShortName "Blue... (2 Replies)
Hi Guys,
I need help on deleting particular date files in a directory. I have to delete thousands of files with respect to particular date. Could anyone help on this to delete particular date files at a time?
Thanks in Advance (2 Replies)
Hello All
I am implementing my task in Perl and i found an issue.
What i want to do is to remove files from the directory which were made 20 days back using Perl script (9 Replies)
hello
i am trying to delete some files and also some directories. However, despite having the required permissions (i m the owner), Permission is being denied. I also tried to delete using find and inode number, but again Permission was denied.
:wall:
I am new to unix so please dumb down... (8 Replies)
he following are the files available in my directory
RSK_123_20141113_031500.txt
RSK_123_20141113_081500.txt
RSK_126_20141113_041500.txt
RSK_126_20141113_081800.txt
RSK_128_20141113_091600.txt
Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Hi
My directory structure is as below.
dir1, dir2, dir3
I have the list of files to be deleted in the below path as below.
/staging/retain_for_2years/Cleanup/log $ ls -lrt
total 0
drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2
drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies
LEARN ABOUT MOJAVE
oct
oct(n) oct(n)
__________________________________________________________________________________________________________________________________________________NAME
oct - Encoding "oct"
SYNOPSIS
package require Tcl ?8.2?
package require Trf ?2.1.4?
oct ?options...? ?data?
_________________________________________________________________DESCRIPTION
The command oct is one of several data encodings provided by the package trf. See trf-intro for an overview of the whole package.
This encoding transforms every byte in the input into a sequence of 3 characters containing the octal representation of the byte. For
example
% oct -mode encode Z
132
oct ?options...? ?data?
-mode encode|decode
This option has to be present and is always understood by the encoding.
For immediate mode the argument value specifies the operation to use. For an attached encoding it specifies the operation to
use for writing. Reading will automatically use the reverse operation. See section IMMEDIATE versus ATTACHED for explana-
tions of these two terms.
Beyond the argument values listed above all unique abbreviations are recognized too.
Encode converts from arbitrary (most likely binary) data into the described representation, decode does the reverse .
-attach channel
The presence/absence of this option determines the main operation mode of the transformation.
If present the transformation will be stacked onto the channel whose handle was given to the option and run in attached mode.
More about this in section IMMEDIATE versus ATTACHED.
If the option is absent the transformation is used in immediate mode and the options listed below are recognized. More about
this in section IMMEDIATE versus ATTACHED.
-in channel
This options is legal if and only if the transformation is used in immediate mode. It provides the handle of the channel the
data to transform has to be read from.
If the transformation is in immediate mode and this option is absent the data to transform is expected as the last argument
to the transformation.
-out channel
This options is legal if and only if the transformation is used in immediate mode. It provides the handle of the channel the
generated transformation result is written to.
If the transformation is in immediate mode and this option is absent the generated data is returned as the result of the com-
mand itself.
IMMEDIATE VERSUS ATTACHED
The transformation distinguishes between two main ways of using it. These are the immediate and attached operation modes.
For the attached mode the option -attach is used to associate the transformation with an existing channel. During the execution of the com-
mand no transformation is performed, instead the channel is changed in such a way, that from then on all data written to or read from it
passes through the transformation and is modified by it according to the definition above. This attachment can be revoked by executing the
command unstack for the chosen channel. This is the only way to do this at the Tcl level.
In the second mode, which can be detected by the absence of option -attach, the transformation immediately takes data from either its com-
mandline or a channel, transforms it, and returns the result either as result of the command, or writes it into a channel. The mode is
named after the immediate nature of its execution.
Where the data is taken from, and delivered to, is governed by the presence and absence of the options -in and -out. It should be noted
that this ability to immediately read from and/or write to a channel is an historic artifact which was introduced at the beginning of Trf's
life when Tcl version 7.6 was current as this and earlier versions have trouble to deal with characters embedded into either input or
output.
SEE ALSO
ascii85, base64, bin, hex, oct, otp_words, quoted-printable, trf-intro, uuencode
KEYWORDS
bin, encoding, hex, oct
COPYRIGHT
Copyright (c) 1996-2003, Andreas Kupries <andreas_kupries@users.sourceforge.net>
Trf transformer commands 2.1.4 oct(n)