Re: find script?



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
.



Relevant Pages

  • Re: Voice Message
    ... Norman Zhang wrote: ... >> the messages and (using the extension number) associates the call with ... Then it sends the message to the mailbox. ... have the WAV file played right at the PC. ...
    (microsoft.public.exchange.admin)
  • Re: Formal proof that sqrt(2) is irrational?
    ... fernando revilla wrote: ... is a field (extension of Q), ... interpretation of sqrtas the letter S, ... e.g. if you intend on using the following implication ...
    (sci.math)
  • Comdial FXS and Interchange 12.0 Message Lamp Problem
    ... I have problem getting the message light to ... extension number than the mailbox number. ... I can go to any phone extension and hit the intercom and dial * ...
    (comp.dcom.telecom.tech)
  • Re: Ping Jeff Hobbs about tcllib-nntp
    ... While the newsgroup sometimes seems like an extension of my regular ... mailbox;), David was correct in that the SF projects all have their ...
    (comp.lang.tcl)
  • Re: Hidden file, unknown extension
    ... Wes. ... The name that shows in Properties is 'Kiss My......(just the dots, ... leaves the old one with no extension on the desktop. ...
    (microsoft.public.windowsxp.general)