CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   Correction to the script wcleanMachine (https://www.cfd-online.com/Forums/openfoam-bugs/62468-correction-script-wcleanmachine.html)

mbeaudoin June 10, 2008 07:30

Hello, I would like to prop
 
Hello,

I would like to propose a small correction to the script wcleanMachine in order to correctly cleanup the Make directory under src/Pstream/mpi.

With the actual current version of wcleanMachine, the clean-up is not made properly under src/Pstream/mpi/ because the script only looks for an exact machine pattern under the Make directory, which usually is $WM_OPTIONS.

But under src/Pstream/mpi, we usually end up with directory names like this:

Make/$(WM_OPTIONS)MPI or
Make/$(WM_OPTIONS)LAM or
Make/$(WM_OPTIONS)OPENMPI

and wcleanMachine fails to remove those.

So I would like to propose this little modification to the script wcleanMachine in order to handle this cleanup problem:


# find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -name "*$1" \) -exec rm -r {
\; # <---- old version}
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -regex ".*$1\|.*$1$WM_MPLIB" \) -exec rm -r { \;}


Martin

henry June 10, 2008 10:21

Thanks for the suggestion, I h
 
Thanks for the suggestion, I have put it in 1.5

Henry

mbeaudoin June 10, 2008 13:05

Thanks Henry, Please take n
 
Thanks Henry,

Please take note that I messed up the braces syntax of the last part of the find command while playing with the Forum Message formatting language.

Here are the two lines again, but without any formatting:

#find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -name "*$1" \) -exec rm -r {} \;
find `find . -depth \( -name "Make.[A-Za-z]*" -o -name "Make" \) -type d -print` -depth \( -type d -regex ".*$1\|.*$1$WM_MPLIB" \) -exec rm -r {} \;

Sorry about that,

and thanks to Bernhard for pointing that one out.

Martin

henry June 10, 2008 14:18

Yes I noticed the error and co
 
Yes I noticed the error and corrected it. I also changed the -regex to -name ... -o ... as I am not sur we can rely on all implementations of find support -regex.

H

mbeaudoin June 10, 2008 15:38

Indeed, according to the man p
 
Indeed, according to the man page, "-name" and "-o" are specified in the POSIX standard, which should be more portable.

Thanks for the tip!

Martin


All times are GMT -4. The time now is 03:52.