|
from: "Lehti, Eric" <elehti@xxxxxxxxxxxx>
subject: RE: [External] Delete old IFS files
You are looking for this FIND script
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Patrik Schindler
Sent: Saturday, October 2, 2021 5:41 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [External] Re: Finding empty folders on IFS and QSH find
[WARNING]: External Email
Hello K.,
Am 01.10.2021 um 17:41 schrieb K Crawford <kscx3ksc@xxxxxxxxx>:
This works. find /home/kcrawford -type d
I am open to other solutions.
A simple shell-script will do also. I assume there are no blanks in the
directory names!
Here, find generates a list of all directories starting from the current
directory, listing the most nested directories first (so directories
freeing directories can be probably identified as free, and deleted). For
every entry, a "ls" command prints *all* entries, line by line. An empty
directory has only two lines, two entries for . and .., so it's safe to
assume that a directory with only two entries is empty and can be safely
removed.
for DIR in `find . -depth -type d`; do
if [ `ls -1a ${DIR} |wc -l` -eq 2 ]; then
rmdir ${DIR}
fi
done
Tested in qsh with 7.2, no error messages. Can be used as one-liner, or
saved in a *STMF with indents to help understanding at a later point in
time. :-)
Important! The backticks are *not* apostrophes! You may see these like a
braced expression in mathematics.
:wq! PoC
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Gad
Miron
Sent: Wednesday, January 12, 2022 2:20 AM
To: midrange-l@xxxxxxxxxxxxxxxxxx
Subject: [External] Delete old IFS files
[WARNING]: External Email
Hello guys
Sometime ago I have seen a SQL script to delete old IFS files (older then
30 days for instance)
Was it here on Midrange?
Was it a Scott Frostie jem?
Anyone in the know?
TIA
Gad
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.