diff --git a/bin/foamAllHC b/bin/foamAllHC index e6ebd3ac90..5c6797d52e 100755 --- a/bin/foamAllHC +++ b/bin/foamAllHC @@ -32,7 +32,7 @@ if [ "$#" -gt 0 ] then - find . -name "*.[CHL]" -exec $1 {} \; -print + find . -name "*.[CHL]" -type f -exec $1 {} \; -print fi #------------------------------------------------------------------------------ diff --git a/bin/foamPack b/bin/foamPack index 212d0d5e5a..3e0a994e68 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -119,7 +119,7 @@ else ( cd $packDir && git archive --format=tar --prefix=$packDir/ HEAD) > $packBase.tar && echo "add in time-stamp and lnInclude directories" 1>&2 && - tar cf $packBase.tar2 $packDir/.timeStamp $packDir/.build $(find -H $packDir -type d -name lnInclude) && + tar cf $packBase.tar2 $packDir/.timeStamp $packDir/.build $(find -H $packDir -name lnInclude -type d) && tar Af $packBase.tar $packBase.tar2 && echo "gzip tar file" 1>&2 && diff --git a/bin/foamSequenceVTKFiles b/bin/foamSequenceVTKFiles index 86e5122283..8ebb755ace 100755 --- a/bin/foamSequenceVTKFiles +++ b/bin/foamSequenceVTKFiles @@ -93,7 +93,7 @@ if [ ! -d $DIR ]; then exit 0 fi -FILES=$(find $DIR -type f -name *vtk) +FILES=$(find $DIR -name '*.vtk' -type f) NAMES=$(for f in $FILES; do basename $f .vtk; done | sort -u) if [ -d $OUT ]; then diff --git a/bin/rmcore b/bin/rmcore index 046758cd75..8dde81b3cc 100755 --- a/bin/rmcore +++ b/bin/rmcore @@ -35,6 +35,7 @@ then set -- . elif [ "$1" = "-h" -o "$1" = "-help" ] then + exec 1>&2 echo "Usage: ${0##*/} [dir1] .. [dirN]" echo " remove all core files" exit 1 @@ -45,8 +46,8 @@ for i do if [ -d "$i" ] then - echo "removing all core files: $i" - find $i \( -type f -name 'core' -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -print | xargs -t rm 2>/dev/null + echo "removing all core files: $i" 1>&2 + find $i \( -name core -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -type f -delete else echo "no directory: $i" 1>&2 fi diff --git a/bin/rm~all b/bin/rm~all index adbd5c6601..c4fa742f89 100755 --- a/bin/rm~all +++ b/bin/rm~all @@ -35,6 +35,7 @@ then set -- . elif [ "$1" = "-h" -o "$1" = "-help" ] then + exec 1>&2 echo "Usage: ${0##*/} [dir1] .. [dirN]" echo " remove all *~ files" exit 1 @@ -45,8 +46,8 @@ for i do if [ -d "$i" ] then - echo "removing all *~ files: $i" - find $i \( -name '*~' -o -name '.*~' \) -print | xargs -t rm 2>/dev/null + echo "removing all *~ files: $i" 1>&2 + find $i \( -name '*~' -o -name '.*~' \) -type f -delete -print else echo "no directory: $i" 1>&2 fi diff --git a/tutorials/Allclean b/tutorials/Allclean index b66c19975f..0eea9fb549 100755 --- a/tutorials/Allclean +++ b/tutorials/Allclean @@ -4,10 +4,14 @@ cd ${0%/*} || exit 1 # Run from this directory echo "--------" echo "Cleaning tutorials ..." echo "Removing backup files" -find . -type f \( -name "*~" -o -name "*.bak" \) -exec rm {} \; -find . \( -name core -o -name 'core.[1-9]*' \) -exec rm {} \; -find . \( -name '*.pvs' -o -name '*.OpenFOAM' \) -exec rm {} \; -rm logs testLoopReport > /dev/null 2>&1 + +find . \( \ + -name '*~' -o -name '*.bak' \ + -name core -o -name 'core.[1-9]*' \ + -name '*.pvs' -o -name '*.OpenFOAM' \ + \) -type f -delete + +rm -f logs testLoopReport > /dev/null 2>&1 foamCleanTutorials cases diff --git a/tutorials/Allrun b/tutorials/Allrun index 8ecef75019..28e4fe6a45 100755 --- a/tutorials/Allrun +++ b/tutorials/Allrun @@ -138,7 +138,7 @@ do [ -d $appDir ] || continue echo -n " $appDir..." 1>&2 - logs=$(find -L $appDir -type f -name 'log.*') + logs=$(find -L $appDir -name 'log.*' -type f) if [ -n "$logs" ] then echo 1>&2 diff --git a/tutorials/Alltest b/tutorials/Alltest index ac39728960..d122fd25e8 100755 --- a/tutorials/Alltest +++ b/tutorials/Alltest @@ -211,7 +211,7 @@ fi echo "Modifying the controlDicts to run only one time step" 1>&2 cd ${TEST_RUN_DIR} || exit 1 -for CD in $(find . -type f -name "controlDict*") +for CD in $(find . -name "controlDict*" -type f) do mv ${CD} ${CD}.orig sed \ @@ -225,7 +225,7 @@ done if [ "$DEFAULT_SCHEMES" = true ] then echo "Modifying the fvSchemes to contain only default schemes" 1>&2 - for FV_SC in $(find . -type f -name fvSchemes) + for FV_SC in $(find . -name fvSchemes -type f) do for S in $FV_SCHEMES do @@ -253,7 +253,7 @@ do do rm $SCHEMES_TEMP $SOLVERS_TEMP > /dev/null 2>&1 echo " ${ST}" >> $SCHEMES_FILE - for LOG in $(find ${APP} -type f -name "log.${APP}") + for LOG in $(find ${APP} -name "log.${APP}" -type f) do for S in $(grep ${ST} ${LOG} | cut -d" " -f4) do diff --git a/tutorials/incompressible/pisoFoam/LES/motorBike/motorBike/Allrun b/tutorials/incompressible/pisoFoam/LES/motorBike/motorBike/Allrun index 43ab19017d..b3fbef3291 100755 --- a/tutorials/incompressible/pisoFoam/LES/motorBike/motorBike/Allrun +++ b/tutorials/incompressible/pisoFoam/LES/motorBike/motorBike/Allrun @@ -17,7 +17,7 @@ runApplication decomposePar -decomposeParDict system/decomposeParDict.hierarchic # \cp system/decomposeParDict.ptscotch system/decomposeParDict runParallel snappyHexMesh -decomposeParDict system/decomposeParDict.ptscotch -profiling -overwrite -find . -type f -iname "*level*" -exec rm {} \; +find . -iname '*level*' -type f -delete #- Set the initial fields restore0Dir -processor diff --git a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun index 9f85d96372..fd62abc0fa 100755 --- a/tutorials/incompressible/simpleFoam/turbineSiting/Allrun +++ b/tutorials/incompressible/simpleFoam/turbineSiting/Allrun @@ -14,7 +14,7 @@ runApplication decomposePar \cp system/decomposeParDict.ptscotch system/decomposeParDict runParallel snappyHexMesh -overwrite -find . -type f -iname "*level*" -exec rm {} \; +find . -iname '*level*' -type f -delete # - Set the initial fields restore0Dir -processor diff --git a/wmake/scripts/makeFiles b/wmake/scripts/makeFiles index 78b7fffed3..09b487219a 100755 --- a/wmake/scripts/makeFiles +++ b/wmake/scripts/makeFiles @@ -56,7 +56,7 @@ do done >> Make/files [ -s Make/files ] && echo >> Make/files -for file in $(find . -type f -name "*.[cCylLfF]" -print) +for file in $(find . -name "*.[cCylLfF]" -type f -print) do pathName=$(echo ${file%/*} | $dirToString -strip) diff --git a/wmake/wclean b/wmake/wclean index 71c8cd096a..1ed0cf21ac 100755 --- a/wmake/wclean +++ b/wmake/wclean @@ -153,10 +153,10 @@ then # Get sub-directories avoiding particular directories for dir in $(find . -mindepth 1 -maxdepth 1 \ - -type d \( -name .git -prune -o -print \) ) + -name .git -prune -o -type d -print) do echo " searching: $dir" - find $dir -depth -type d -empty -exec rmdir {} \; -print + find $dir -depth -empty -type d -delete -print done # Second pass: clean up object directories with WM_PROJECT_DIR that don't diff --git a/wmake/wcleanLnIncludeAll b/wmake/wcleanLnIncludeAll index 4ac19b6816..3a4510874a 100755 --- a/wmake/wcleanLnIncludeAll +++ b/wmake/wcleanLnIncludeAll @@ -58,7 +58,7 @@ do if [ -d "$dir" ] then echo "removing lnInclude directories: $dir" - find $dir -depth -type d -name lnInclude -exec rm -rf {} \; + find $dir -depth -name lnInclude -type d -delete else echo "no directory: $dir" 1>&2 fi diff --git a/wmake/wcleanPlatform b/wmake/wcleanPlatform index 18b4d5b2c3..34767739b7 100755 --- a/wmake/wcleanPlatform +++ b/wmake/wcleanPlatform @@ -89,7 +89,7 @@ then rm -rf platforms/* echo "Removing lnInclude directories" - find . -depth -type d \( -name lnInclude \) | xargs rm -rf + find . -depth -name lnInclude -type d -delete tutorials/Allclean else diff --git a/wmake/wmakeLnInclude b/wmake/wmakeLnInclude index 0b338ac742..edfeb540e1 100755 --- a/wmake/wmakeLnInclude +++ b/wmake/wmakeLnInclude @@ -149,7 +149,7 @@ fi #------------------------------------------------------------------------------ # Remove any broken links first (this helps when file locations have moved) #------------------------------------------------------------------------------ -find -L . -type l | xargs rm -f +find -L . -type l -delete #------------------------------------------------------------------------------ diff --git a/wmake/wrmdep b/wmake/wrmdep index 1d37a1564c..55cddd68c6 100755 --- a/wmake/wrmdep +++ b/wmake/wrmdep @@ -152,15 +152,14 @@ files) if [ "$#" -eq 0 ] then echo "removing all .dep files ..." - find $objectsDir -type f -name '*.dep' -print | xargs -t rm 2>/dev/null + find $objectsDir -name '*.dep' -type f -delete -print else echo "removing .o files corresponding to" echo " $@ ..." for file do - find $objectsDir -type f -name '*.dep' \ - -exec grep -q "$file" '{}' \; \ - -exec rm '{}' \; -print + find $objectsDir -name '*.dep' -type f \ + -exec grep -q "$file" {} \; -delete -print done fi ;; @@ -183,7 +182,7 @@ oldFolders) continue fi - find $objectsDir -type f -name '*.dep' -print | while read depFile + find $objectsDir -name '*.dep' -type f -print | while read depFile do sourceFile=$(depToSource $depFile) @@ -205,7 +204,7 @@ updateMode) fi echo "Removing dep files corresponding to source files that no longer exist..." - fileNameList=$(find -L src applications -type l -name '*.[CHL]') + fileNameList=$(find -L src applications -name '*.[CHL]' -type l) for filePathAndName in $fileNameList do diff --git a/wmake/wrmo b/wmake/wrmo index 489e179736..ee4e1ce523 100755 --- a/wmake/wrmo +++ b/wmake/wrmo @@ -103,7 +103,7 @@ fi if [ "$#" -eq 0 ] then echo "removing all .o files ..." - find $objectsDir -type f -name '*.o' -print | xargs -t rm 2>/dev/null + find $objectsDir -name '*.o' -type f -delete else echo "removing .o files corresponding to" echo " $@ ..."