Re: find script?
- From: ibuprofin@xxxxxxxxxxxxxxxxxxxxxx (Moe Trin)
- Date: Fri, 08 Aug 2008 14:49:50 -0500
On Thu, 07 Aug 2008, in the Usenet newsgroup linux.redhat, in article
<j%Lmk.17654$mh5.3430@xxxxxxxxxxxxxxxxxxxx>, noi ance wrote:
Moe Trin typed this message:
P1 wrote:
Most accounts work fine, but a few hundred don't and I found that
they don't because the INBOX.MBX file case doesn't match the
INBOX.IDX file case, so the system can't find the index for the
mailbox file and hence shows the mailbox as empty. I need to find
all directories where these two files have a different case so that
I can fix that problem.
find /var/spool/mbox -type f \( -name \*.IDX -o -name \*.MBX \) | cut
-d'.' -f1 | sort -f | uniq -u
One _other_ thing I'd look at is to see that there are no case errors
in the file extensions
find /var/spool/mbox -type f \( -iname \*.IDX -o -iname \*.MBX \) |
grep -v .IDX | grep -v .MBX
Ordinarily, I wouldn't comment but ....
above | grep v .IDX | grep -v .MBX would only eliminate *.IDX and
*.MBX but I think the OP actually wanted to be inclusive *Mbx, *MBX,
*mBX, *mbX, for examples.
My interpretation of the need was from an earlier post, where he wrote
] Find all subfolders with a file.ext1 and file.ext2 but only where the
] letter case of "file" is different. There are three possible ways the
] name can be spelled: file, File and FILE.
Now I took that as meaning that the extension was not the problem, and
as a result, the '.IDX' and '.MBX' was the desired extension. Perhaps
you are interpreting that differently. The effect of the two 'grep -v'
functions would be to eliminate files with these extensions, and
anything that is output (which due to the find can only be an extension
with one or more lower case letters) would be something for the admin
to look at further.
Note that any "corrections" to the filenames are being done _manually_
so it is expected that the person doing so is thinking.
Also the cut "." f1 would produce /home/moetrim/file, /home/moetrim/
file1, /home/moetrim/file2/not, etc.
for files
/home/moetrim/file.is.longer.MBx, /home/moetrim/file1.not.that.1.mbx
and /home/moetrim/file2/not.MbX
and I think the OP wanted just
/home/moetrim/
/home/moetrim/file2
Mailbox names are generally related to the 'user' name. While RFC2822
para 3.4.1 (and the earlier RFC0822 para 6.2) merely state that the
username is a "locally interpreted string" (or 'domain-dependent string'
in the earlier document), most operating systems specify that the name
contains alpha-numerics, the dash, and underscore. Dots are STRONGLY
discouraged because this may confuse some MUAs, as would spaces. If
the filename does contain dots other than the dot separating the name
and extension, the 'cut' command could be replaced by a 'sed' command
at minor increase in CPU time.
Old guy
.
- References:
- find script?
- From: P1
- Re: find script?
- From: Moe Trin
- Re: find script?
- From: P1
- Re: find script?
- From: Moe Trin
- Re: find script?
- From: noi ance
- find script?
- Prev by Date: [CentOS] Substitution for createrepo
- Next by Date: Re: Red Hat 5 and Realtek RTL8101 fast ethernet card.
- Previous by thread: Re: find script?
- Next by thread: Change Language
- Index(es):
Relevant Pages
|