find automatically recurses into sub-directories and in fact there is a -maxdepth parameter on many find implementations that allows limits to be placed on how far down it will search.
This User Gave Thanks to Chubler_XL For This Post:
If the file cannot e moved outside the Mailboxes directory, but anywhere within it, find should do the trick.
Hope this helps
Note that if there are one or more files in the current directory with names ending in mbox, this won't do what you want. For example, if there is a file named mymbox in the current directory, but no file named mymbox in or under /Userpath/Library/Mail/Mailboxes, the find command won't list any files even if there are dozens of other files with names ending in mbox. If there are two or more files in the current directory with names ending in mbox when you run the above command, you'll get a syntax error from find.
To let find expand the filename pattern while evaluating the -name primary, you need to quote the pattern to keep the shell from expanding it before passing the expansion to find:
These 2 Users Gave Thanks to Don Cragun For This Post:
Will this work if the target (SRC) file gets moved to a directory recursively? such as /Mailboxes/Folder/test.mbox? I'm assuming I would use find -r?
Yes, as Chubbler stated, find goes all recursive, either from the path providded as in this example, or just from the current path if none is provided.
Don, right, but since he's 'afraid' of the user moving the mailbox, why not consider the users might also rename the mailboxfile?
Thanks for the quotation need, didnt thought of that late night.
Anyhow, most users (i know of) dont move their mailbox around.
They MIGHT set it up at a diffrent location though, but in that case, parsing that directory (that is not used) will return nothing.
Thanks for the responses, they added some clarity for my script build. For transparency, the reason I wanted this to dynamically follow the path is because its an IMAP mailbox that is being used by multiple clients- so the chance of something getting moved by accident is definitely there.
Hi experts,
I have multiple file names ending with .jsp located in $SOME_DIR, $SOME_DIR/f1/,$SOME_DIR/f2/test,$SOME_DIR/f3/fa
and there are equivalent class files in $SOME_DIR/WEB-INF/classes/_pages,$SOME_DIR/WEB-INF/classes/_pages/_f1,... (0 Replies)
Hi
I have a file which has values in each line:
MP304,d40000
MP310,ff0000
etc
I have another file which as the first value in it and is unique in the file(not repeated). I need to replace a string with the second value above. The second file contents is as follows:(snippet)
<g
... (12 Replies)
Undefined first referenced
symbol in file
logf /var/tmp//ccwztFsO.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
float exponC(float mean)
{
index1++;... (1 Reply)
I am referencing variables in the following way
var1="greeting"
greeting="Welcome!"
How do I echo var1 in such a way that it outputs Welcome! ? (3 Replies)
Is it possible to design a shell script to reference something that queries for input?
(This is not to make a script to ssh)
For instance if I have a command that when run, it does something like:
%<Some command>
User's password? Would it be possible to write a script to input something... (1 Reply)
Hi,
I have tried all examples of back referencing from the web but all in vain.
It would be heavily helpful if someone explains me the use of back referencing and sub expression using an example of substitution.
Thanks (1 Reply)
Hey everyone, I can't figure out this symbol referencing error after looking at it for the longest time, and I figured some fresh eyes might be able to point something out I am overlooking.
Undefined first referenced
symbol in... (1 Reply)
Undefined first referenced
symbol in file
std::basic_ostream<char, std::char_traits<char> >::operator<<(int)/var/tmp//ccTR
std::cerr /var/tmp//ccTRcjui.o
std::cout /var/tmp//ccTRcjui.o... (1 Reply)
The script I am writing must be able to run several commands (tar, gzip etc) on filenames that are supplied by variables. I am unsure as to what syntax is required/ideal when referencing variables in filenames. The following is a sample command that I would like the script to execute:
tar cvf... (3 Replies)
I can't seem to find anywhere how to syntactically reference a range of parameters in the script I am trying to write.
My script requires at least 2 parameters to run, with parameter 1 being the main file, which I want appended to x amount of target files, which will be parameters 2 through... (4 Replies)