diff --git a/applications/test/List3/Test-List3.C b/applications/test/List3/Test-List3.C
index 685500821169a327338c575366ca636cba394642..e23b36579bea92b145e897a859ab9f1d27f0ffe7 100644
--- a/applications/test/List3/Test-List3.C
+++ b/applications/test/List3/Test-List3.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2019 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
         {
             if (true)
             {
-                IFstream is(args[argi]);
+                IFstream is(args.get<fileName>(argi));
 
                 Info<< nl << nl
                     << "read from " << is.name() << nl << endl;
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
 
             if (true)
             {
-                IFstream is(args[argi]);
+                IFstream is(args.get<fileName>(argi));
 
                 Info<< nl << nl
                     << "read from " << is.name() << nl << endl;
diff --git a/applications/test/PackedList/Test-PackedList.C b/applications/test/PackedList/Test-PackedList.C
index b6f5582a839e3692fd7767fb030163fe6931aaae..771be2a35528a39e7045275eb04d949688e0f0e6 100644
--- a/applications/test/PackedList/Test-PackedList.C
+++ b/applications/test/PackedList/Test-PackedList.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -125,9 +126,9 @@ int main(int argc, char *argv[])
     }
 
 
-    for (label argI=1; argI < args.size(); ++argI)
+    for (label argi=1; argi < args.size(); ++argi)
     {
-        const string& srcFile = args[argI];
+        const auto srcFile = args.get<fileName>(argi);
         Info<< nl << "reading " << srcFile << nl;
 
         IFstream ifs(srcFile);
diff --git a/applications/test/checkDecomposePar/Test-checkDecomposePar.C b/applications/test/checkDecomposePar/Test-checkDecomposePar.C
index 805b57b9ec77d26c99c721f1a3ac49b199316ecd..41e46a9cf6af75afac9c51d6d81a806094bf0131 100644
--- a/applications/test/checkDecomposePar/Test-checkDecomposePar.C
+++ b/applications/test/checkDecomposePar/Test-checkDecomposePar.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -74,8 +74,7 @@ int main(int argc, char *argv[])
 
     #include "setRootCase.H"
 
-    const fileName decompFile = args[1];
-
+    const auto decompFile = args.get<fileName>(1);
     const bool region     = args.found("region");
     const bool allRegions = args.found("allRegions");
     const bool verbose    = args.found("verbose");
diff --git a/applications/test/codeStream/Test-codeStream.C b/applications/test/codeStream/Test-codeStream.C
index fc3b656436a8cae5ddf049ece3c2ee0225ceddb3..49b04ac2f1de474e17b924ce72a2bd98849a4d1f 100644
--- a/applications/test/codeStream/Test-codeStream.C
+++ b/applications/test/codeStream/Test-codeStream.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -59,9 +60,9 @@ int main(int argc, char *argv[])
     else
     {
         IOobject::writeDivider(Info);
-        for (label argI=1; argI < args.size(); ++argI)
+        for (label argi=1; argi < args.size(); ++argi)
         {
-            const string& dictFile = args[argI];
+            const auto dictFile = args.get<fileName>(argi);
             IFstream is(dictFile);
 
             dictionary dict(is);
diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C
index 402038e6a92fb6045e3b2cb60adb5d5bbd3b4f5c..7931a97abfc8d0e6b7fc844d3afc5366d0be27a4 100644
--- a/applications/test/coordinateSystem/Test-coordinateSystem.C
+++ b/applications/test/coordinateSystem/Test-coordinateSystem.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
 
         for (label argi=1; argi < args.size(); ++argi)
         {
-            const string& dictFile = args[argi];
+            const auto dictFile = args.get<fileName>(argi);
             IFstream is(dictFile);
 
             dictionary inputDict(is);
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
     {
         for (label argi=1; argi < args.size(); ++argi)
         {
-            const string& dictFile = args[argi];
+            const auto dictFile = args.get<fileName>(argi);
             IFstream is(dictFile);
 
             dictionary inputDict(is);
diff --git a/applications/test/copyFile/Test-copyFile.C b/applications/test/copyFile/Test-copyFile.C
index c3be05dc1394b30c3f74eff84aae2b7aa8ce53f5..616aefc410da5f028b014ab889065b64cc5f4ab1 100644
--- a/applications/test/copyFile/Test-copyFile.C
+++ b/applications/test/copyFile/Test-copyFile.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -135,8 +135,8 @@ int main(int argc, char *argv[])
     args.readIfPresent("maxPath", maxPath);
     #endif
 
-    const fileName srcFile(fileName::validate(args[1]));
-    const fileName dstFile(fileName::validate(args[2]));
+    const auto srcFile = args.get<fileName>(1);
+    const auto dstFile = args.get<fileName>(2);
     const fileName tmpFile(dstFile + Foam::name(pid()));
 
     Info<< "src   : " << srcFile << nl
diff --git a/applications/test/decomposedBlockData/Test-decomposedBlockData.C b/applications/test/decomposedBlockData/Test-decomposedBlockData.C
index 9edc26ee7e267f957100d21091a2529966dde841..2402055210dee31d62b44040bb942fe6403eadc3 100644
--- a/applications/test/decomposedBlockData/Test-decomposedBlockData.C
+++ b/applications/test/decomposedBlockData/Test-decomposedBlockData.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2017 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -54,7 +55,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    const fileName file(args[1]);
+    const auto file = args.get<fileName>(1);
 
     Info<< "Reading " << file << nl << endl;
     decomposedBlockData data
diff --git a/applications/test/dictionary/Test-dictionary.C b/applications/test/dictionary/Test-dictionary.C
index 5e12dbd7ef3e40c3920999248c0ed9f38237b54e..1c5c7a30e11286043bf7653221cfbb32b493d51e 100644
--- a/applications/test/dictionary/Test-dictionary.C
+++ b/applications/test/dictionary/Test-dictionary.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2012 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -123,9 +124,9 @@ int main(int argc, char *argv[])
     else
     {
         IOobject::writeDivider(Info);
-        for (label argI=1; argI < args.size(); ++argI)
+        for (label argi=1; argi < args.size(); ++argi)
         {
-            const string& dictFile = args[argI];
+            const auto dictFile = args.get<fileName>(argi);
             IFstream is(dictFile);
 
             dictionary dict(is);
diff --git a/applications/test/dictionaryCopy/Test-dictionaryCopy.C b/applications/test/dictionaryCopy/Test-dictionaryCopy.C
index 264c88e3e8dbd3fb16d1825454ad0bfcdea0f0ef..4ab58d3a0a4e2dbcf07d076c82f1b888b232434e 100644
--- a/applications/test/dictionaryCopy/Test-dictionaryCopy.C
+++ b/applications/test/dictionaryCopy/Test-dictionaryCopy.C
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
 
     for (label argi=1; argi < args.size(); ++argi)
     {
-        const string& dictFile = args[argi];
+        const auto dictFile = args.get<fileName>(argi);
         IFstream is(dictFile);
 
         dictionary input(is);
diff --git a/applications/test/dictionaryTokens/Test-dictionaryTokens.C b/applications/test/dictionaryTokens/Test-dictionaryTokens.C
index 3760124cab1f7050609779b0af2ce91ad80dec26..1b8967b7638e4d65e5c9a5f0fae3826f97aed496 100644
--- a/applications/test/dictionaryTokens/Test-dictionaryTokens.C
+++ b/applications/test/dictionaryTokens/Test-dictionaryTokens.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
 
     for (label argi=1; argi < args.size(); ++argi)
     {
-        IFstream is(args[argi]);
+        IFstream is(args.get<fileName>(argi));
 
         dictionary dict(is);
 
diff --git a/applications/test/dynamicLibrary/Test-dynamicLibrary.C b/applications/test/dynamicLibrary/Test-dynamicLibrary.C
index ee7009b96180a811b609b4ab5ddfcea9d7e4cca5..0e878a5616c02c13cd6fa2ccc6fd3d39504d0a52 100644
--- a/applications/test/dynamicLibrary/Test-dynamicLibrary.C
+++ b/applications/test/dynamicLibrary/Test-dynamicLibrary.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
 
     for (int argi = 1; argi < args.size(); ++argi)
     {
-        const fileName libName(fileName::validate(args[argi]));
+        const auto libName = args.get<fileName>(argi);
 
         if (libName.empty())
         {
diff --git a/applications/test/exprEntry/Test-exprEntry.C b/applications/test/exprEntry/Test-exprEntry.C
index e5b76da7b70396021f687737c958f58113b2a56e..1f14bbf45aa65f55c218bd8a1aded1036fdf01a4 100644
--- a/applications/test/exprEntry/Test-exprEntry.C
+++ b/applications/test/exprEntry/Test-exprEntry.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -79,7 +79,7 @@ int main(int argc, char *argv[])
     {
         IOobject::writeDivider(Info);
 
-        IFstream is(args[argi]);
+        IFstream is(args.get<fileName>(argi));
 
         const dictionary dict(is);
 
diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C
index 5c368dbdfb7e0e4ecbf7348f07209d2a2cce9dca..c6bdd486df50a15eb97020d823fa09b2a8677301 100644
--- a/applications/test/fileName/Test-fileName.C
+++ b/applications/test/fileName/Test-fileName.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2017 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -60,7 +60,7 @@ unsigned testClean(std::initializer_list<Pair<std::string>> tests)
         const std::string& expected = test.second();
 
         fileName cleaned(test.first());
-        cleaned.clean();
+        cleaned.clean();  // Remove unneeded ".."
 
         if (cleaned == expected)
         {
diff --git a/applications/test/fileNameClean/Test-fileNameClean.C b/applications/test/fileNameClean/Test-fileNameClean.C
index f368778a4479e141c5aed0691e7a8c276d04568b..b6a23325ce6688d5e67318df43919a4023c0dda4 100644
--- a/applications/test/fileNameClean/Test-fileNameClean.C
+++ b/applications/test/fileNameClean/Test-fileNameClean.C
@@ -5,7 +5,8 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -24,11 +25,10 @@ License
     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 
 Application
-    fileNameCleanTest
+    Test-fileNameClean
 
 Description
 
-
 \*---------------------------------------------------------------------------*/
 
 #include "argList.H"
@@ -51,7 +51,7 @@ void printCleaning(fileName& pathName)
     Info<< "components  = " << flatOutput(pathName.components()) << nl;
     Info<< "component 2 = " << pathName.component(2) << nl;
 
-    pathName.clean();
+    pathName.clean();  // Remove unneeded ".."
 
     Info<< "cleaned  = " << pathName << nl
         << "  path() = " << pathName.path() << nl
@@ -94,9 +94,15 @@ int main(int argc, char *argv[])
         printCleaning(pathName);
     }
 
-    for (label argI=1; argI < args.size(); ++argI)
+    for (label argi=1; argi < args.size(); ++argi)
     {
-        pathName = args[argI];
+        fileName fn(args[argi], false); // no strip
+        Info<< "Input = " << fn << nl;
+        fn.clean();  // Remove unneeded ".."
+        Info<< "cleaned = " << fn << nl;
+        Info<< "get = " << args.get<fileName>(argi) << nl;
+
+        pathName = fileName::validate(args[argi]);
         printCleaning(pathName);
     }
 
diff --git a/applications/test/fstreamPointer/Test-fstreamPointer.C b/applications/test/fstreamPointer/Test-fstreamPointer.C
index 6f12abd9a0122abfed52637bb0179c74ac4c2ad5..2cad909ace13fda75eb6a1e1643ee00bd898ffb7 100644
--- a/applications/test/fstreamPointer/Test-fstreamPointer.C
+++ b/applications/test/fstreamPointer/Test-fstreamPointer.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@@ -81,7 +81,7 @@ int main(int argc, char *argv[])
 
     for (label argi = 1; argi < args.size(); ++argi)
     {
-        const fileName inputName(args[argi]);
+        const auto inputName = args.get<fileName>(argi);
 
         InfoErr<< "input: " << inputName;
 
diff --git a/applications/test/mvBak/Test-mvBak.C b/applications/test/mvBak/Test-mvBak.C
index 9c9b6c7172d73dd936cddac56fbae8afb27b2e7d..7c6ff169ff1bd3892a9ef7012ed5246d2de770b9 100644
--- a/applications/test/mvBak/Test-mvBak.C
+++ b/applications/test/mvBak/Test-mvBak.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -53,9 +54,9 @@ int main(int argc, char *argv[])
 
     label ok = 0;
 
-    for (label argI=1; argI < args.size(); ++argI)
+    for (label argi=1; argi < args.size(); ++argi)
     {
-        const string& srcFile = args[argI];
+        const auto srcFile = args.get<fileName>(argi);
 
         if (args.found("ext"))
         {
diff --git a/applications/test/plotFunction1/Test-plotFunction1.C b/applications/test/plotFunction1/Test-plotFunction1.C
index 9ddc5cc0246ddde13496db5cd7ecf31357a0aa55..99bc8769a80e672bf3256d662ddc08a892215d62 100644
--- a/applications/test/plotFunction1/Test-plotFunction1.C
+++ b/applications/test/plotFunction1/Test-plotFunction1.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -73,7 +73,7 @@ int main(int argc, char *argv[])
 
     for (label argi=1; argi < args.size(); ++argi)
     {
-        IFstream is(args[argi]);
+        IFstream is(args.get<fileName>(argi));
 
         dictionary dict(is);
 
diff --git a/applications/test/regex1/Test-regex1.C b/applications/test/regex1/Test-regex1.C
index b84d7d00a39ae862a4a9daec34b84185adf07929..9f917355a96e58b44f8c7822cf1e319b26469969 100644
--- a/applications/test/regex1/Test-regex1.C
+++ b/applications/test/regex1/Test-regex1.C
@@ -375,7 +375,7 @@ int main(int argc, char *argv[])
 
     for (label argi = 1; argi < args.size(); ++argi)
     {
-        IFstream is(args[argi]);
+        IFstream is(args.get<fileName>(argi));
         List<regexTest> tests(is);
 
         Info<< "Test expressions:" << tests << endl;
diff --git a/applications/test/spline/Test-spline.C b/applications/test/spline/Test-spline.C
index 4d9af262dcb574b8c4edb7e939e4a3d71fbe658d..9785da0fdb78a248356b2b8dc9dacbb9f719d05d 100644
--- a/applications/test/spline/Test-spline.C
+++ b/applications/test/spline/Test-spline.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -76,9 +76,9 @@ int main(int argc, char *argv[])
         useCatmullRom = true;
     }
 
-    for (label argI=1; argI < args.size(); ++argI)
+    for (label argi=1; argi < args.size(); ++argi)
     {
-        const string& srcFile = args[argI];
+        const auto srcFile = args.get<fileName>(argi);
         Info<< nl << "reading " << srcFile << nl;
         IFstream ifs(srcFile);
 
diff --git a/applications/test/surfaceIntersection/Test-surfaceIntersection.C b/applications/test/surfaceIntersection/Test-surfaceIntersection.C
index c3e2731b937a3faee5dd36e0f95aa524952682af..e0c6c218b3d43e74c498013202248b4b0bb8107d 100644
--- a/applications/test/surfaceIntersection/Test-surfaceIntersection.C
+++ b/applications/test/surfaceIntersection/Test-surfaceIntersection.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -139,13 +139,13 @@ int main(int argc, char *argv[])
 
     const word outputFile(args.executable() + ".obj");
 
-    const fileName surf1Name(args[1]);
+    const auto surf1Name = args.get<fileName>(1);
     triSurface surf1 = loadSurface(runTime, surf1Name, scaleFactor)();
     Info<< surf1Name << " statistics:" << endl;
     surf1.writeStats(Info);
     Info<< endl;
 
-    const fileName surf2Name(args[2]);
+    const auto surf2Name = args.get<fileName>(2);
     triSurface surf2 = loadSurface(runTime, surf2Name, scaleFactor)();
     Info<< surf2Name << " statistics:" << endl;
     surf2.writeStats(Info);
diff --git a/applications/test/surfaceReading/Test-surfaceReading.C b/applications/test/surfaceReading/Test-surfaceReading.C
index ea6572039cf78c3199b3cb1d82d524fd4007db97..bd0c39d12b024d6d5b9c1fe95f159c29856faab7 100644
--- a/applications/test/surfaceReading/Test-surfaceReading.C
+++ b/applications/test/surfaceReading/Test-surfaceReading.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
 
     #include "setRootCase.H"
 
-    const fileName importName = args[1];
+    const auto importName = args.get<fileName>(1);
 
     word ext;
     if (!args.readIfPresent("ext", ext))
diff --git a/applications/test/surfaceWriter/Test-surfaceWriter.C b/applications/test/surfaceWriter/Test-surfaceWriter.C
index c1826f2fe17588fdf17c316426fdec57402de193..3d8ee9cf258ef6148e1590c926b56ae7908b7584 100644
--- a/applications/test/surfaceWriter/Test-surfaceWriter.C
+++ b/applications/test/surfaceWriter/Test-surfaceWriter.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -68,8 +68,8 @@ int main(int argc, char *argv[])
 
     #include "setRootCase.H"
 
-    const fileName importName = args[1];
-    const fileName exportName = args[2];
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.get<fileName>(2);
 
     if (importName == exportName)
     {
diff --git a/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C b/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C
index 1cc4ad302641edf48168da487902f64bb69648e3..c01b249f733f856d164cb104a737a22bf0f95151 100644
--- a/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C
+++ b/applications/test/vtkSeriesWriter/Test-vtkSeriesWriter.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
 
     for (label argi=1; argi < args.size(); ++argi)
     {
-        const auto& input = args[argi];
+        const auto input = args.get<fileName>(argi);
 
         Info << "load from " << input << nl;
 
diff --git a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
index cafcdf67adc4bbc216358089585946e172d4c58b..66cb8534a5be9ae4e8cc5d2bf212db5eafc39c7a 100644
--- a/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
+++ b/applications/utilities/mesh/conversion/ansysToFoam/ansysToFoam.L
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -327,7 +327,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    const fileName ansysFile(args[1]);
+    const auto ansysFile = args.get<fileName>(1);
     std::ifstream ansysStream(ansysFile);
 
     if (!ansysStream)
diff --git a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C
index 14855f09315f071cc200f960b1a3aafbe8f965f8..876a6d59becbc1d6765ffc3af78b8c0bb3da1ef4 100644
--- a/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C
+++ b/applications/utilities/mesh/conversion/ccm/ccmToFoam/ccmToFoam.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
     }
 
     // CCM reader for reading geometry/solution
-    ccm::reader reader(args[1], rOpts);
+    ccm::reader reader(args.get<fileName>(1), rOpts);
 
     // list the geometry information
     if (optList)
diff --git a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
index 903767ab43b7fc21fa7b99241a351db10aee08e6..3039c16a5662bd8308c61a40c5956915c2196488 100644
--- a/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
+++ b/applications/utilities/mesh/conversion/cfx4ToFoam/cfx4ToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    IFstream cfxFile(args[1]);
+    IFstream cfxFile(args.get<fileName>(1));
 
     // Read the cfx information using a fixed format reader.
     // Comments in the file are in C++ style, so the stream parser will remove
diff --git a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
index 2e3dd0d452416a6761163ec2f28d29f5eb64e5d8..8a526ab5cf936e973d615049f745df5ca0b74f0a 100644
--- a/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
+++ b/applications/utilities/mesh/conversion/datToFoam/datToFoam.C
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    std::ifstream plot3dFile(args[1]);
+    std::ifstream plot3dFile(args.get<fileName>(1));
 
     string line;
     std::getline(plot3dFile, line);
diff --git a/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C b/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C
index 021907f09674a44086491ebd7729a94944f77a29..b3809ff16038ff14f5984db269ad221dc2b8bdd1 100644
--- a/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C
+++ b/applications/utilities/mesh/conversion/fireToFoam/fireToFoam.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
 
     fileFormats::FIREMeshReader reader
     (
-        args[1],
+        args.get<fileName>(1),
         // Default no scaling
         args.getOrDefault<scalar>("scale", 1)
     );
diff --git a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
index 066da1368a18f087601ecde64cd6f60bf308cbc7..98d751ee0dfb340e540c8773d4d6c3ec8cafc921 100644
--- a/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluent3DMeshToFoam/fluent3DMeshToFoam.L
@@ -835,7 +835,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    const fileName fluentFile = args[1];
+    const auto fluentFile = args.get<fileName>(1);
     IFstream fluentStream(fluentFile);
 
     if (!fluentStream)
diff --git a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
index 8623da54ecfd594c8feac1600b37f55f0fd06fca..8d70aa39f96e257b75271d5ffdde09b86251c2a1 100644
--- a/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
+++ b/applications/utilities/mesh/conversion/fluentMeshToFoam/fluentMeshToFoam.L
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -912,7 +912,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    const fileName fluentFile = args[1];
+    const auto fluentFile = args.get<fileName>(1);
     std::ifstream fluentStream(fluentFile);
 
     if (!fluentStream)
diff --git a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
index 17703601d86f1ceb6925e1f284a003b85f6079f2..53b359a2f2c5fb8904a1dfb551ad561686316962 100644
--- a/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
+++ b/applications/utilities/mesh/conversion/foamToSurface/foamToSurface.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
 
     #include "setRootCase.H"
 
-    fileName exportName = args[1];
+    auto exportName = args.get<fileName>(1);
 
     const scalar scaleFactor = args.getOrDefault<scalar>("scale", 0);
     const bool doTriangulate = args.found("tri");
diff --git a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
index cbd4172c75043613d97660d7678586a3cd3aa414..f8a226a63585d9de47b4be49bf7b758139721b79 100644
--- a/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
+++ b/applications/utilities/mesh/conversion/gambitToFoam/gambitToFoam.L
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -653,7 +653,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    const fileName gambitFile = args[1];
+    const auto gambitFile = args.get<fileName>(1);
     std::ifstream gambitStream(gambitFile);
 
     if (!gambitStream)
diff --git a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
index 02a17f42352ff531ef6d951076083dcec51446f3..b7e6909ff27e8208802b533c230f4c85557e7466 100644
--- a/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
+++ b/applications/utilities/mesh/conversion/gmshToFoam/gmshToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -1325,7 +1325,7 @@ int main(int argc, char *argv[])
     }
 
     const bool keepOrientation = args.found("keepOrientation");
-    IFstream inFile(args[1]);
+    IFstream inFile(args.get<fileName>(1));
 
     // Storage for points
     pointField points;
diff --git a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
index 6c2d2188b6c1737045422b4cb46e1ea6ca39ef52..4c3fe7cc4777c60b8044b85ee75d0ce510307952 100644
--- a/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
+++ b/applications/utilities/mesh/conversion/ideasUnvToFoam/ideasUnvToFoam.C
@@ -666,7 +666,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const fileName ideasName = args[1];
+    const auto ideasName = args.get<fileName>(1);
     IFstream inFile(ideasName);
 
     if (!inFile.good())
diff --git a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
index 20088ce4ca2e2d7ab0b993c0d500116e44a5514f..1bfa8f7183af506829787b74e056802f2eeef434 100644
--- a/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
+++ b/applications/utilities/mesh/conversion/mshToFoam/mshToFoam.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -77,7 +78,7 @@ int main(int argc, char *argv[])
     #include "createTime.H"
 
     const bool readHex = args.found("hex");
-    IFstream mshStream(args[1]);
+    IFstream mshStream(args.get<fileName>(1));
 
     label nCells;
     mshStream >> nCells;
diff --git a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
index cbae422f00f6bc236bdbbce649927d6e3476795a..81e0280d22e41363b59807a16572170a2b769099 100644
--- a/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
+++ b/applications/utilities/mesh/conversion/netgenNeutralToFoam/netgenNeutralToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    IFstream str(args[1]);
+    IFstream str(args.get<fileName>(1));
 
     //
     // Read nodes.
diff --git a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
index 78e8381bb63b43f0ea8abb8c4a2c0a5599675c58..1a95f8fec2ed2ce64d7f478d9291d4686ecd55e1 100644
--- a/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
+++ b/applications/utilities/mesh/conversion/plot3dToFoam/plot3dToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
 
     #include "createTime.H"
 
-    IFstream plot3dFile(args[1]);
+    IFstream plot3dFile(args.get<fileName>(1));
 
     // Read the plot3d information using a fixed format reader.
     // Comments in the file are in C++ style, so the stream parser will remove
diff --git a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
index 24a6c28f7059fef77435fac541ec2376ecaea6de..b48f1b6bd052b1e014ae532ee091d918836fb245 100644
--- a/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
+++ b/applications/utilities/mesh/conversion/star4ToFoam/star4ToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
 
 
     // Remove extensions and/or trailing '.'
-    const fileName prefix = fileName(args[1]).lessExt();
+    const auto prefix = args.get<fileName>(1).lessExt();
 
 
     fileFormats::STARCDMeshReader reader
diff --git a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
index 55ac13b40ca594558211b133b3621f3a7838a5d3..1d457708d84bf98d63fa211e7ec99e6a9d8e91d9 100644
--- a/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
+++ b/applications/utilities/mesh/conversion/tetgenToFoam/tetgenToFoam.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2020 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const fileName prefix = args[1];
+    const auto prefix = args.get<fileName>(1);
     const bool readFaceFile = !args.found("noFaceFile");
 
     const fileName nodeFile(prefix + ".node");
diff --git a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
index 377458839f7f0c9daa8b6b79de1b4b6e133f3c6c..cb8f5577349c84fefc0aee28513f5a9af991864f 100644
--- a/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
+++ b/applications/utilities/mesh/conversion/vtkUnstructuredToFoam/vtkUnstructuredToFoam.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -65,7 +66,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    IFstream mshStream(args[1]);
+    IFstream mshStream(args.get<fileName>(1));
 
     vtkUnstructuredReader reader(runTime, mshStream);
 
diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
index 00a843e531228bcd7aacfba900ea63ed219a5850..136967f73b6175d3773e0d2526a59dc6de349b44 100644
--- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/conformalVoronoiMesh.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -289,7 +289,7 @@ void Foam::conformalVoronoiMesh::insertSurfacePointPairs
         }
     }
 
-    if (foamyHexMeshControls().objOutput() && fName != fileName::null)
+    if (foamyHexMeshControls().objOutput() && !fName.empty())
     {
         DelaunayMeshTools::writeOBJ(time().path()/fName, pts);
     }
@@ -324,7 +324,7 @@ void Foam::conformalVoronoiMesh::insertEdgePointGroups
         }
     }
 
-    if (foamyHexMeshControls().objOutput() && fName != fileName::null)
+    if (foamyHexMeshControls().objOutput() && !fName.empty())
     {
         DelaunayMeshTools::writeOBJ(time().path()/fName, pts);
     }
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C
index 699c0f1a7d82f87ac9b77c41b8ed29c87850238d..2a355d70c1cff74dd8d13b67600c49b972dffce7 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2016 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -378,7 +378,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const fileName exportName = args[1];
+    const auto exportName = args.get<fileName>(1);
 
     Info<< "Reading surfaces as specified in the foamyHexMeshDict and"
         << " writing a re-sampled surface to " << exportName
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C
index 611bc5279309cd7d6ba2bd3831395f250008883a..1cfd57f9e8c09df3759ffe4b86dff6e99f4429e5 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify/foamyHexMeshSurfaceSimplify_non_octree.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2012-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -64,8 +64,8 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const labelVector n(args.get<labelVector>(1));
-    const fileName exportName = args[2];
+    const auto n = args.get<labelVector>(1);
+    const auto exportName = args.get<fileName>(2);
 
     Info<< "Reading surfaces as specified in the foamyHexMeshDict and"
         << " writing re-sampled " << n << " to " << exportName
diff --git a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
index 82f0ab9731e5bc72951ece46fc1064546b616786..919b8120713d24fd37f05fe8f4a111e23fd863db 100644
--- a/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
+++ b/applications/utilities/mesh/generation/foamyMesh/foamyQuadMesh/foamyQuadMesh.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2013-2016 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -97,7 +98,7 @@ int main(int argc, char *argv[])
 
     if (args.found("pointsFile"))
     {
-        mesh.insertPoints(args["pointsFile"]);
+        mesh.insertPoints(args.get<fileName>("pointsFile"));
     }
     else
     {
diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
index b9fedffe615356f19853e3e3b97d221eb6633f91..1218dadddefefd96d95546ffd4d3992b4da0988f 100644
--- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
+++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMesh.C
@@ -541,7 +541,7 @@ void extractSurface
           ? runTime.globalPath()/outFileName
           : runTime.path()/outFileName
         );
-        globalCasePath.clean();
+        globalCasePath.clean();  // Remove unneeded ".."
 
         Info<< "Writing merged surface to " << globalCasePath << endl;
 
diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
index e7ab6c2d17f12d55b13e4996f274bb8d22c319ed..ad29e420dc3f8eb32f9915f6a961a1ab90c3948d 100644
--- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
+++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C
@@ -306,7 +306,7 @@ void Foam::mergeAndWrite
       / mesh.pointsInstance()
       / set.name()
     );
-    outputDir.clean();
+    outputDir.clean();  // Remove unneeded ".."
 
     mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir);
 }
@@ -399,7 +399,7 @@ void Foam::mergeAndWrite
       / mesh.pointsInstance()
       / set.name()
     );
-    outputDir.clean();
+    outputDir.clean();  // Remove unneeded ".."
 
     mergeAndWrite(mesh, writer, set.name(), setPatch, outputDir);
 }
@@ -498,7 +498,7 @@ void Foam::mergeAndWrite
           / mesh.pointsInstance()
           // set.name()
         );
-        outputDir.clean();
+        outputDir.clean();  // Remove unneeded ".."
         mkDir(outputDir);
 
         fileName outputFile(outputDir/writer.getFileName(points, wordList()));
diff --git a/applications/utilities/mesh/manipulation/insideCells/insideCells.C b/applications/utilities/mesh/manipulation/insideCells/insideCells.C
index a3d19eb384fc8dcbe654ad220bc9d38e8b2c0e36..07b4a629d2ee71206889e4d80865ad702c925f15 100644
--- a/applications/utilities/mesh/manipulation/insideCells/insideCells.C
+++ b/applications/utilities/mesh/manipulation/insideCells/insideCells.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -66,8 +66,8 @@ int main(int argc, char *argv[])
     #include "createTime.H"
     #include "createPolyMesh.H"
 
-    const fileName surfName = args[1];
-    const fileName setName  = args[2];
+    const auto surfName = args.get<fileName>(1);
+    const auto setName  = args.get<fileName>(2);
 
     // Read surface
     Info<< "Reading surface from " << surfName << endl;
diff --git a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
index 92b38c546b51f541af15cdadd7285866b341b746..5fa4a4f626a0e33661e514da204254b893edebb8 100644
--- a/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
+++ b/applications/utilities/mesh/manipulation/mergeMeshes/mergeMeshes.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -45,7 +45,7 @@ using namespace Foam;
 
 void getRootCase(fileName& casePath)
 {
-    casePath.clean();
+    casePath.clean();  // Remove unneeded ".."
 
     if (casePath.empty() || casePath == ".")
     {
@@ -56,7 +56,7 @@ void getRootCase(fileName& casePath)
     {
         // avoid relative cases ending in '..' - makes for very ugly names
         casePath = cwd()/casePath;
-        casePath.clean();
+        casePath.clean();  // Remove unneeded ".."
     }
 }
 
@@ -102,8 +102,8 @@ int main(int argc, char *argv[])
 
     const bool overwrite = args.found("overwrite");
 
-    fileName masterCase = args[1];
-    fileName addCase = args[2];
+    auto masterCase = args.get<fileName>(1);
+    auto addCase = args.get<fileName>(2);
 
     const word masterRegion =
         args.getOrDefault<word>("masterRegion", polyMesh::defaultRegion);
diff --git a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
index 8965219067ce7ddb42e0acc9fabeba1e82daf641..4ff92cf77a8a93a0b9a5c4f87b259c53f2e7f2a1 100644
--- a/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
+++ b/applications/utilities/mesh/manipulation/objToVTK/objToVTK.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -123,8 +123,8 @@ int main(int argc, char *argv[])
     argList::addArgument("vtk-file", "The output vtk file");
     argList args(argc, argv);
 
-    const fileName objName = args[1];
-    const fileName outName = args[2];
+    const auto objName = args.get<fileName>(1);
+    const auto outName = args.get<fileName>(2);
 
     std::ifstream OBJfile(objName);
 
diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C
index 1473bf293fa84e1f855f24b6d8adcbbb31b3fffd..b866b07cb25285fbed2eb3787e5ad54ac1a4dae2 100644
--- a/applications/utilities/mesh/manipulation/setSet/setSet.C
+++ b/applications/utilities/mesh/manipulation/setSet/setSet.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2018 OpenFOAM Foundation
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -793,7 +793,7 @@ int main(int argc, char *argv[])
 
         if (batch)
         {
-            const fileName batchFile = args["batch"];
+            const auto batchFile = args.get<fileName>("batch");
 
             Info<< "Reading commands from file " << batchFile << endl;
 
diff --git a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C
index 97eeb2ccbaacef36aed7adfb4852804aa634dabb..fddf9b20c2f28e3273c7e1d5c27e12e12e52a0b3 100644
--- a/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C
+++ b/applications/utilities/miscellaneous/foamDictionary/foamDictionary.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2016-2017 OpenFOAM Foundation
-    Copyright (C) 2017-2019 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -373,7 +373,7 @@ int main(int argc, char *argv[])
         }
     }
 
-    const fileName dictFileName(args[1]);
+    const auto dictFileName = args.get<fileName>(1);
 
     autoPtr<IFstream> dictFile(new IFstream(dictFileName));
     if (!dictFile().good())
diff --git a/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C b/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C
index 07243cac4007caa2fb3e6176c5ad2885b2ae99fc..398b2397163e29f8adb486f9ffaccde7a1c628e4 100644
--- a/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C
+++ b/applications/utilities/miscellaneous/foamHasLibrary/foamHasLibrary.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
 
     for (int argi = 1; argi < args.size(); ++argi)
     {
-        const fileName libName(fileName::validate(args[argi]));
+        const auto libName = args.get<fileName>(argi);  // with validate
 
         if (libName.empty())
         {
diff --git a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
index af91270a9e59fc055c131ac49e495020a8fd59ae..49bb2b1239a5d9cc87a0e7f3d17bd041ebdee032 100644
--- a/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
+++ b/applications/utilities/postProcessing/dataConversion/smapToFoam/smapToFoam.C
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
 
     #include "createNamedMesh.H"
 
-    IFstream smapFile(args[1]);
+    IFstream smapFile(args.get<fileName>(1));
 
     if (!smapFile.good())
     {
diff --git a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C
index 1925d5d56992281c3d4cbc5b8ddb8cdc9dc66671..ef5597dcae0b4988a37ff76d5eb19948db43e38f 100644
--- a/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C
+++ b/applications/utilities/postProcessing/lumped/lumpedPointMovement/lumpedPointMovement.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -150,7 +150,7 @@ int main(int argc, char *argv[])
 
     args.readIfPresent("visual-length", lumpedPointState::visLength);
 
-    const fileName responseFile(args[1]);
+    const auto responseFile = args.get<fileName>(1);
 
     // ----------------------------------------------------------------------
     // Slave mode
diff --git a/applications/utilities/preProcessing/mapFields/mapFields.C b/applications/utilities/preProcessing/mapFields/mapFields.C
index 9e7b984745e6f24548d141d4df84f6a3ee893b5e..78645b20b4a14272be1dd30d212bebba81879210 100644
--- a/applications/utilities/preProcessing/mapFields/mapFields.C
+++ b/applications/utilities/preProcessing/mapFields/mapFields.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -286,7 +286,7 @@ int main(int argc, char *argv[])
     fileName rootDirTarget(args.rootPath());
     fileName caseDirTarget(args.globalCaseName());
 
-    fileName casePath = args[1];
+    const auto casePath = args.get<fileName>(1);
     const fileName rootDirSource = casePath.path().toAbsolute();
     const fileName caseDirSource = casePath.name();
 
diff --git a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
index 7c6435f1e424cba6338ecc46f94ce734bc2aae68..025c400b2675b3eabd584333b9d507d7e530da08 100644
--- a/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
+++ b/applications/utilities/preProcessing/mapFieldsPar/mapFieldsPar.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2018 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
     fileName rootDirTarget(args.rootPath());
     fileName caseDirTarget(args.globalCaseName());
 
-    const fileName casePath = args[1];
+    const auto casePath = args.get<fileName>(1);
     const fileName rootDirSource = casePath.path();
     const fileName caseDirSource = casePath.name();
 
diff --git a/applications/utilities/surface/surfaceAdd/surfaceAdd.C b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
index 6195dd3c6878aa6f0ccd539f08a142f3bfd4a26c..0db4feefd1f46e579204accf40405a44e94bb0a1 100644
--- a/applications/utilities/surface/surfaceAdd/surfaceAdd.C
+++ b/applications/utilities/surface/surfaceAdd/surfaceAdd.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -83,9 +83,9 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName inFileName1 = args[1];
-    const fileName inFileName2 = args[2];
-    const fileName outFileName = args[3];
+    const auto inFileName1 = args.get<fileName>(1);
+    const auto inFileName2 = args.get<fileName>(2);
+    const auto outFileName = args.get<fileName>(3);
 
     const bool addPoint     = args.found("points");
     const bool mergeRegions = args.found("mergeRegions");
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
             << nl << endl;
 
         Info<< "Surface  : " << inFileName1<< nl
-            << "Points   : " << args["points"] << nl
+            << "Points   : " << args.get<fileName>("points") << nl
             << "Writing  : " << outFileName << nl << endl;
     }
     else
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
 
     if (addPoint)
     {
-        IFstream pointsFile(args["points"]);
+        IFstream pointsFile(args.get<fileName>("points"));
         const pointField extraPoints(pointsFile);
 
         Info<< "Additional Points:" << extraPoints.size() << endl;
diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
index 87a04e1e2166170d4298fb5b96182c3ebdc5b3d4..4d3b9e39feca5ecd61813c91a01c4a6bd8767763 100644
--- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C
+++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -335,7 +335,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName surfFileName = args[1];
+    const auto surfFileName = args.get<fileName>(1);
     const bool checkSelfIntersect = args.found("checkSelfIntersection");
     const bool splitNonManifold = args.found("splitNonManifold");
     const label outputThreshold =
diff --git a/applications/utilities/surface/surfaceClean/surfaceClean.C b/applications/utilities/surface/surfaceClean/surfaceClean.C
index 98c850c6950da2e1f8c9d6e1a67e7a3b7e09ecff..f1e62642318fe8e1ffe7c99301cd1ad6b54fabba 100644
--- a/applications/utilities/surface/surfaceClean/surfaceClean.C
+++ b/applications/utilities/surface/surfaceClean/surfaceClean.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -82,10 +82,10 @@ int main(int argc, char *argv[])
     );
     argList args(argc, argv);
 
-    const fileName inFileName = args[1];
-    const scalar minLen = args.get<scalar>(2);
-    const scalar minQuality = args.get<scalar>(3);
-    const fileName outFileName = args[4];
+    const auto inFileName = args.get<fileName>(1);
+    const auto minLen = args.get<scalar>(2);
+    const auto minQuality = args.get<scalar>(3);
+    const auto outFileName = args.get<fileName>(4);
 
     Info<< "Reading surface " << inFileName << nl
         << "Collapsing all triangles with" << nl
diff --git a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
index 1adad6a7f819ecf0673fd223f0726155274636fb..6db75af3df8b990e4d60dbff2759d101e1e456fe 100644
--- a/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
+++ b/applications/utilities/surface/surfaceCoarsen/surfaceCoarsen.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -92,9 +92,9 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName inFileName = args[1];
-    const scalar reduction = args.get<scalar>(2);
-    const fileName outFileName = args[3];
+    const auto inFileName = args.get<fileName>(1);
+    const auto reduction = args.get<scalar>(2);
+    const auto outFileName = args.get<fileName>(3);
 
     if (reduction <= 0 || reduction > 1)
     {
diff --git a/applications/utilities/surface/surfaceConvert/surfaceConvert.C b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
index f65f316f8d2a9ca64a134a5599038f9180f47e0c..3530da1ae181d8f7feaa2e7821ee533dc6a8334b 100644
--- a/applications/utilities/surface/surfaceConvert/surfaceConvert.C
+++ b/applications/utilities/surface/surfaceConvert/surfaceConvert.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -159,8 +159,8 @@ int main(int argc, char *argv[])
         }
     }
 
-    const fileName importName(args[1]);
-    const fileName exportName(args[2]);
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.get<fileName>(2);
 
     if (importName == exportName)
     {
diff --git a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
index 087b0eed278c2e1bf8d1d1e578a19de3484808de..03c64a2f390b0246388cabc0feaf453e9af3b1e9 100644
--- a/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
+++ b/applications/utilities/surface/surfaceFeatureConvert/surfaceFeatureConvert.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2015 OpenFOAM Foundation
-    Copyright (C) 2015-2020 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -106,8 +106,8 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
     Time runTime(args.rootPath(), args.caseName());
 
-    const fileName importName(args[1]);
-    const fileName exportName(args[2]);
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.get<fileName>(2);
 
     // Disable inplace editing
     if (importName == exportName)
diff --git a/applications/utilities/surface/surfaceFind/surfaceFind.C b/applications/utilities/surface/surfaceFind/surfaceFind.C
index e23ce768478ec95df61d8c7db124af56edffd716..1f69a792e6993e391b313b81b04df82e2839b5a1 100644
--- a/applications/utilities/surface/surfaceFind/surfaceFind.C
+++ b/applications/utilities/surface/surfaceFind/surfaceFind.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
 
 
     Info<< "Reading surf ..." << endl;
-    meshedSurface surf1(args[1]);
+    meshedSurface surf1(args.get<fileName>(1));
 
     //
     // Nearest vertex
diff --git a/applications/utilities/surface/surfaceInertia/surfaceInertia.C b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
index 7147ce4656edbcd339ae08262a1ffdf864b61126..2b5120978843c4882df69b4f804cabbf95485a11 100644
--- a/applications/utilities/surface/surfaceInertia/surfaceInertia.C
+++ b/applications/utilities/surface/surfaceInertia/surfaceInertia.C
@@ -6,7 +6,7 @@
     \\/      M anipulation   |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2020 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -88,7 +88,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName surfFileName = args[1];
+    const auto surfFileName = args.get<fileName>(1);
     const scalar density = args.getOrDefault<scalar>("density", 1);
 
     vector refPt = Zero;
diff --git a/applications/utilities/surface/surfaceInflate/surfaceInflate.C b/applications/utilities/surface/surfaceInflate/surfaceInflate.C
index 333533f2fa927851cbb861f8211a7bd5b46c7e3c..a2d52a992d08a9980dbd2f3e60024a0fcb670fb3 100644
--- a/applications/utilities/surface/surfaceInflate/surfaceInflate.C
+++ b/applications/utilities/surface/surfaceInflate/surfaceInflate.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2015 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -609,12 +609,12 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const word inputName(args[1]);
-    const scalar distance(args.get<scalar>(2));
-    const scalar extendFactor(args.get<scalar>(3));
+    const auto inputName = args.get<word>(1);
+    const auto distance = args.get<scalar>(2);
+    const auto extendFactor = args.get<scalar>(3);
     const bool checkSelfIntersect = args.found("checkSelfIntersection");
-    const label nSmooth = args.getOrDefault<label>("nSmooth", 10);
-    const scalar featureAngle = args.getOrDefault<scalar>("featureAngle", 180);
+    const auto nSmooth = args.getOrDefault<label>("nSmooth", 10);
+    const auto featureAngle = args.getOrDefault<scalar>("featureAngle", 180);
     const bool debug = args.found("debug");
 
 
diff --git a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
index a3b99deebc8e685ea8f180342300fa4c91971765..cde4e69ae59ebd074e20a8c875b170b3e44acd41 100644
--- a/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
+++ b/applications/utilities/surface/surfaceLambdaMuSmooth/surfaceLambdaMuSmooth.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -156,11 +156,11 @@ int main(int argc, char *argv[])
     );
     argList args(argc, argv);
 
-    const fileName surfFileName = args[1];
-    const scalar lambda = args.get<scalar>(2);
-    const scalar mu = args.get<scalar>(3);
-    const label  iters = args.get<label>(4);
-    const fileName outFileName = args[5];
+    const auto surfFileName = args.get<fileName>(1);
+    const auto lambda = args.get<scalar>(2);
+    const auto mu = args.get<scalar>(3);
+    const auto iters = args.get<label>(4);
+    const auto outFileName = args.get<fileName>(5);
 
     if (lambda < 0 || lambda > 1)
     {
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
 
     if (args.found("featureFile"))
     {
-        const fileName featureFileName(args["featureFile"]);
+        const auto featureFileName = args.get<fileName>("featureFile");
         Info<< "Reading features from " << featureFileName << " ..." << endl;
 
         edgeMesh feMesh(featureFileName);
diff --git a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
index b2257f39f1d557716793a081dbe62f8c5c38283e..53cfa9651134bbc4de13eae9ca2e0622a294fa0c 100644
--- a/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
+++ b/applications/utilities/surface/surfaceMeshConvert/surfaceMeshConvert.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -181,8 +181,8 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
     Time runTime(args.rootPath(), args.caseName());
 
-    const fileName importName(args[1]);
-    const fileName exportName(args[2]);
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.get<fileName>(2);
 
     if (importName == exportName)
     {
diff --git a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
index d80437d35a3a3e36d3fd088d5c94d5cedcaf1a1a..8469ed0b337b662d18a7a101d6fc45b3052b52db 100644
--- a/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
+++ b/applications/utilities/surface/surfaceMeshExport/surfaceMeshExport.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -155,8 +155,8 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
     Time runTime(args.rootPath(), args.caseName());
 
-    const fileName exportName(args[1]);
-    const word importName(args.getOrDefault<word>("name", "default"));
+    const auto exportName = args.get<fileName>(1);
+    const auto importName = args.getOrDefault<word>("name", "default");
 
     const word writeFileType
     (
diff --git a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C
index 38b364c949dcc3a0ac808c3a0ecda8fefcb0b8f8..25e6bac8a94094b13501e228edcf422d4787d8bc 100644
--- a/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C
+++ b/applications/utilities/surface/surfaceMeshExtract/surfaceMeshExtract.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -156,7 +156,7 @@ int main(int argc, char *argv[])
     #include "setRootCase.H"
     #include "createTime.H"
 
-    const fileName userOutFileName(args[1]);
+    const auto userOutFileName = args.get<fileName>(1);
 
     if (!userOutFileName.hasExt())
     {
diff --git a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
index 469c835a6ecad3851055144c5340ca0cc5ef7477..ba7ca665d2ad3c0de0d06ec5b70946827b4d7867 100644
--- a/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
+++ b/applications/utilities/surface/surfaceMeshImport/surfaceMeshImport.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2018-2020 OpenCFD Ltd.
+    Copyright (C) 2018-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -167,8 +167,8 @@ int main(int argc, char *argv[])
     }
 
 
-    const fileName importName(args[1]);
-    const word exportName(args.getOrDefault<word>("name", "default"));
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.getOrDefault<word>("name", "default");
 
     const word readFileType
     (
diff --git a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
index 6409990bfd85755114ded3b3f08f687d5f214d90..f270125da1b84df5fccb52a783cc83d9237a65b6 100644
--- a/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
+++ b/applications/utilities/surface/surfaceMeshInfo/surfaceMeshInfo.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -107,7 +107,7 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
     Time runTime(args.rootPath(), args.caseName());
 
-    const fileName importName = args[1];
+    const auto importName = args.get<fileName>(1);
 
     // check that reading is supported
     if (!UnsortedMeshedSurface<face>::canRead(importName, true))
diff --git a/applications/utilities/surface/surfaceOrient/surfaceOrient.C b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
index 4158dc04d95d5bf2815c13691bd83ac2e4679592..60750eee2961af17a41196c3a4d67699c3a60b32 100644
--- a/applications/utilities/surface/surfaceOrient/surfaceOrient.C
+++ b/applications/utilities/surface/surfaceOrient/surfaceOrient.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -76,9 +76,9 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName surfFileName = args[1];
-    const point visiblePoint    = args.get<point>(2);
-    const fileName outFileName  = args[3];
+    const auto surfFileName = args.get<fileName>(1);
+    const auto visiblePoint = args.get<point>(2);
+    const auto outFileName  = args.get<fileName>(3);
 
     const bool orientInside = args.found("inside");
     const bool usePierceTest = args.found("usePierceTest");
diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
index 954a5064d9d433b4c2de6efeccf6a9c9cd6963d4..f4057978c0f3c70cc1e44c73f18794dc51549b20 100644
--- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
+++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -67,9 +67,9 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName surfFileName = args[1];
-    const scalar   mergeTol = args.get<scalar>(2);
-    const fileName outFileName = args[3];
+    const auto surfFileName = args.get<fileName>(1);
+    const auto mergeTol = args.get<scalar>(2);
+    const auto outFileName = args.get<fileName>(3);
 
     const scalar scaling = args.getOrDefault<scalar>("scale", -1);
 
diff --git a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
index b50d924bd180435535d1e8487e4fc64183243a92..72e79526a5dc3c17ac1223ffcfa6d89794f88439 100644
--- a/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
+++ b/applications/utilities/surface/surfaceRedistributePar/surfaceRedistributePar.C
@@ -124,8 +124,8 @@ int main(int argc, char *argv[])
     #include "createTime.H"
     runTime.functionObjects().off();
 
-    const fileName surfFileName = args[1];
-    const word distTypeName = args[2];
+    const auto surfFileName = args.get<fileName>(1);
+    const auto distTypeName = args.get<word>(2);
     const label distType =
         distributedTriSurfaceMesh::distributionTypeNames_[distTypeName];
 
diff --git a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
index b92418e1d43d08c9ce0d29286b041851767c71db..b1b51f1a19c5fc27d996d6527234d4171c0ee433 100644
--- a/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
+++ b/applications/utilities/surface/surfaceRefineRedGreen/surfaceRefineRedGreen.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -72,8 +72,8 @@ int main(int argc, char *argv[])
     );
     argList args(argc, argv);
 
-    const fileName surfFileName(args[1]);
-    const fileName outFileName(args[2]);
+    const auto surfFileName = args.get<fileName>(1);
+    const auto outFileName = args.get<fileName>(2);
 
     Info<< "Reading surface from " << surfFileName << " ..." << endl;
 
diff --git a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
index 65649dfd8a5fee7167a9b011416f0680b5ced2f2..940c15848f35fa8b0b0af899828eff50d2559d10 100644
--- a/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
+++ b/applications/utilities/surface/surfaceSplitByPatch/surfaceSplitByPatch.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName surfName = args[1];
+    const auto surfName = args.get<fileName>(1);
 
     const fileName surfBase(surfName.lessExt());
 
diff --git a/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C b/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
index 7afa04af6cc8432d961b49ac166de6fcdcaee130..66f8b117468d103decb9d344074411652b8323e5 100644
--- a/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
+++ b/applications/utilities/surface/surfaceSplitByTopology/surfaceSplitByTopology.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -59,12 +60,12 @@ int main(int argc, char *argv[])
     argList::addArgument("output", "The output surface file");
     argList args(argc, argv);
 
-    fileName surfFileName(args[1]);
+    const auto surfFileName = args.get<fileName>(1);
     Info<< "Reading surface from " << surfFileName << endl;
 
-    fileName outFileName(args[2]);
-    fileName outFileBaseName = outFileName.lessExt();
-    word outExtension = outFileName.ext();
+    const auto outFileName = args.get<fileName>(2);
+    const fileName outFileBaseName = outFileName.lessExt();
+    const word outExtension = outFileName.ext();
 
     // Load surface
     triSurface surf(surfFileName);
diff --git a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
index 8c8cd23c8b72764e1904eecb400674dc51b88023..978af67fae7e3bbbb5685d82c430a2fe310c9ed4 100644
--- a/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
+++ b/applications/utilities/surface/surfaceSplitNonManifolds/surfaceSplitNonManifolds.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -691,8 +691,8 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName inSurfName  = args[1];
-    const fileName outSurfName = args[2];
+    const auto inSurfName  = args.get<fileName>(1);
+    const auto outSurfName = args.get<fileName>(2);
     const bool debug = args.found("debug");
 
     Info<< "Reading surface from " << inSurfName << endl;
diff --git a/applications/utilities/surface/surfaceSubset/surfaceSubset.C b/applications/utilities/surface/surfaceSubset/surfaceSubset.C
index 04031d3f046e71539425bd55f6e972d524195cf3..0f7b60e154fed6d1ff7dda55071744c58b57b0cd 100644
--- a/applications/utilities/surface/surfaceSubset/surfaceSubset.C
+++ b/applications/utilities/surface/surfaceSubset/surfaceSubset.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2015-2020 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -67,15 +67,13 @@ int main(int argc, char *argv[])
     argList args(argc, argv);
 
     Info<< "Reading dictionary " << args[1] << " ..." << endl;
-    IFstream dictFile(args[1]);
+    IFstream dictFile(args.get<fileName>(1));
     dictionary meshSubsetDict(dictFile);
 
     Info<< "Reading surface " << args[2] << " ..." << endl;
+    meshedSurface surf1(args.get<fileName>(2));
 
-    meshedSurface surf1(args[2]);
-
-    const fileName outFileName(args[3]);
-
+    const auto outFileName(args.get<fileName>(3));
 
     Info<< "Original:" << endl;
     surf1.writeStats(Info);
@@ -217,7 +215,7 @@ int main(int argc, char *argv[])
     {
         const dictionary& surfDict = meshSubsetDict.subDict("surface");
 
-        const fileName surfName(surfDict.get<fileName>("name"));
+        const auto surfName(surfDict.get<fileName>("name"));
 
         const volumeType::type volType =
         (
diff --git a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
index 8a78994144f8c6234ecfdf832f30726612035110..d4d31c1ca76df69af279ae60050af17c45b7ef93 100644
--- a/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
+++ b/applications/utilities/surface/surfaceToPatch/surfaceToPatch.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
     #include "createTime.H"
     #include "createPolyMesh.H"
 
-    const fileName surfName = args[1];
+    const auto surfName = args.get<fileName>(1);
 
     Info<< "Reading surface from " << surfName << " ..." << endl;
 
diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
index 85948f878d6aa29ad1b8431c50f446e063332c32..4322a0a530c92150bbd235af9066f440e5e0819a 100644
--- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
+++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -283,8 +283,8 @@ int main(int argc, char *argv[])
         }
     }
 
-    const fileName importName(args[1]);
-    const fileName exportName(args[2]);
+    const auto importName = args.get<fileName>(1);
+    const auto exportName = args.get<fileName>(2);
 
     const word readFileType
     (
diff --git a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
index 780d4eb6c15fce02e902297abf5beac394676b65..220a0da6ddbac025d5ab37ec8636299996be7a23 100644
--- a/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
+++ b/applications/utilities/thermophysical/adiabaticFlameT/adiabaticFlameT.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -70,7 +71,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName controlFileName = args[1];
+    const auto controlFileName = args.get<fileName>(1);
 
     // Construct control dictionary
     IFstream controlFile(controlFileName);
diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
index 2508069f3936c43bb9ca883695e76c827b0d341e..e248c45c979cad3911aed2aa86ad32e67ef0f425 100644
--- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
+++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -76,11 +77,18 @@ int main(int argc, char *argv[])
 
     speciesTable species;
 
-    chemkinReader cr(species, args[1], args[3], args[2], newFormat);
+    chemkinReader cr
+    (
+        species,
+        args.get<fileName>(1),  // chemkin fileName
+        args.get<fileName>(3),  // thermo fileName
+        args.get<fileName>(2),  // transport fileName
+        newFormat
+    );
 
     {
         // output: reactions file
-        OFstream reactionsFile(args[4]);
+        OFstream reactionsFile(args.get<fileName>(4));
 
         reactionsFile.writeEntry("elements", cr.elementNames()) << nl;
         reactionsFile.writeEntry("species", cr.species()) << nl;
@@ -113,7 +121,7 @@ int main(int argc, char *argv[])
 
     // output: thermo file
 
-    thermoDict.write(OFstream(args[5])(), false);
+    thermoDict.write(OFstream(args.get<fileName>(5))(), false);
 
 
     Info<< "End\n" << endl;
diff --git a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
index 8cdbe5060e14972a5544012d7d8e96586fc2d3b0..a6f2e4fb63fb8476784bf4338a36600d5fcfe8fb 100644
--- a/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
+++ b/applications/utilities/thermophysical/equilibriumFlameT/equilibriumFlameT.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -73,7 +74,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName controlFileName = args[1];
+    const auto controlFileName = args.get<fileName>(1);
 
     // Construct control dictionary
     IFstream controlFile(controlFileName);
diff --git a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
index 5d2c3386863bd83e30cc55d925198831c41475e9..c0580d03b9a4cd129346691ce35bed749ee8a404 100644
--- a/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
+++ b/applications/utilities/thermophysical/mixtureAdiabaticFlameT/mixtureAdiabaticFlameT.C
@@ -6,6 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
+    Copyright (C) 2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -69,7 +70,7 @@ int main(int argc, char *argv[])
 
     argList args(argc, argv);
 
-    const fileName controlFileName(args[1]);
+    const auto controlFileName = args.get<fileName>(1);
 
     // Construct control dictionary
     IFstream controlFile(controlFileName);
diff --git a/src/OpenFOAM/db/IOobject/IOobject.C b/src/OpenFOAM/db/IOobject/IOobject.C
index 66f39bded28cedea6d9153b63045af7cbf5256d5..cd478fea9691f130feb8fb0c25d58ff8de399686 100644
--- a/src/OpenFOAM/db/IOobject/IOobject.C
+++ b/src/OpenFOAM/db/IOobject/IOobject.C
@@ -154,8 +154,8 @@ bool Foam::IOobject::fileNameComponents
     // Convert explicit relative file-system path to absolute file-system path.
     if (path.starts_with("./") || path.starts_with("../"))
     {
-        fileName absPath = cwd()/path;
-        absPath.clean();
+        fileName absPath(cwd()/path);
+        absPath.clean();  // Remove unneeded ".."
 
         return fileNameComponents(absPath, instance, local, name);
     }
diff --git a/src/OpenFOAM/db/dictionary/dictionarySearch.C b/src/OpenFOAM/db/dictionary/dictionarySearch.C
index 7b7a9e65cbe605a15ef889300c55217350da9c90..401c7825d7a2fc75b4198fd1a6073d0ec513fb79 100644
--- a/src/OpenFOAM/db/dictionary/dictionarySearch.C
+++ b/src/OpenFOAM/db/dictionary/dictionarySearch.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2017-2019 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -184,7 +184,7 @@ Foam::dictionary::const_searcher Foam::dictionary::csearchSlashScoped
     }
     else if (slash == 0)
     {
-        // (isAbsolute)
+        // isAbsolute:
         // Ascend to top-level
         while (&dictPtr->parent_ != &dictionary::null)
         {
@@ -385,8 +385,9 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDict
     }
 
     const dictionary* dictPtr = this;
-    if (fileName::isAbsolute(dictPath))
+    if (dictPath[0] == '/')
     {
+        // isAbsolute:
         // Ascend to top-level
         while (&dictPtr->parent_ != &dictionary::null)
         {
@@ -394,10 +395,11 @@ const Foam::dictionary* Foam::dictionary::cfindScopedDict
         }
     }
 
-    fileName path = dictPath.clean();
-    const wordList cmpts = path.components();
+    fileName path(dictPath); // Work on copy
+    path.clean();  // Remove unneeded ".."
+    const wordList dictCmpts(path.components()); // Split on '/'
 
-    for (const word& cmpt : cmpts)
+    for (const word& cmpt : dictCmpts)
     {
         if (cmpt == ".")
         {
@@ -486,8 +488,9 @@ Foam::dictionary* Foam::dictionary::makeScopedDict(const fileName& dictPath)
     }
 
     dictionary* dictPtr = this;
-    if (fileName::isAbsolute(dictPath))
+    if (dictPath[0] == '/')
     {
+        // isAbsolute:
         // Ascend to top-level
         while (&dictPtr->parent_ != &dictionary::null)
         {
@@ -495,14 +498,11 @@ Foam::dictionary* Foam::dictionary::makeScopedDict(const fileName& dictPath)
         }
     }
 
-    // Work on a copy, without any assumptions
-    std::string path = dictPath;
-    fileName::clean(path);
+    std::string path(dictPath); // Work on a copy
+    fileName::clean(path);  // Remove unneeded ".."
+    auto dictCmpts = stringOps::split(path, '/'); // Split on '/'
 
-    // Split on '/'
-    auto cmpts = stringOps::split(path, '/');
-
-    for (const auto& cmpt : cmpts)
+    for (const auto& cmpt : dictCmpts)
     {
         if (cmpt == ".")
         {
diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
index 36cb7cdd0a53198affd7982c12e45f86a5e616d4..51be217fda8cf1d7b88023b01ecbae1a016ac207 100644
--- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
+++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C
@@ -52,7 +52,7 @@ Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
     // Put in undecomposed case
     // (Note: gives problems for distributed data running)
 
-    fileName baseDir =
+    fileName baseDir
     (
         fileObr_.time().globalPath()
       / functionObject::outputPrefix
@@ -67,7 +67,6 @@ Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
             baseDir /= mesh.name();
         }
     }
-
     baseDir.clean();  // Remove unneeded ".."
 
     return baseDir;
diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C
index fc62b4bd044755187950c5400a70a635c850ff82..4f4f957e441e2bee6cb1347bd28e0b55b46fcde6 100644
--- a/src/OpenFOAM/global/argList/argList.C
+++ b/src/OpenFOAM/global/argList/argList.C
@@ -715,8 +715,7 @@ void Foam::argList::setCasePaths()
 
     if (optIter.found())
     {
-        caseDir = fileName::validate(optIter.val());
-        caseDir.clean();
+        caseDir = fileName::validate(optIter.val());  // includes 'clean'
 
         if (caseDir.empty() || caseDir == ".")
         {
@@ -1193,7 +1192,7 @@ void Foam::argList::parse
                 // Could also check for absolute path, but shouldn't be needed
                 if (adjustOpt)
                 {
-                    source.clean();
+                    source.clean();  // Remove unneeded ".."
                     options_.set("decomposeParDict", source);
                 }
             }
diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H
index 75ffd9dbef4e70546118aed061336b7fce0d642b..e9d022b545505d058fb525fa8e04f3b25d67b09e 100644
--- a/src/OpenFOAM/global/argList/argList.H
+++ b/src/OpenFOAM/global/argList/argList.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -378,6 +378,7 @@ public:
 
         //- Get a value from the argument at index.
         //  Index 1 is the first (non-option) argument.
+        //  For fileName type, invokes fileName::validate()
         template<class T>
         inline T get(const label index) const;
 
@@ -388,6 +389,7 @@ public:
 
         //- Get a value from the named option
         //  The default template parameter is string (ie, no conversion).
+        //  For fileName type, invokes fileName::validate()
         template<class T=string>
         inline T get(const word& optName) const;
 
diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H
index ed6f1fe59c5f9d8db2dce31ab4b2d0f18d1b13d1..83344cdf2d964fe37f7a8684d6d67ed776b52f89 100644
--- a/src/OpenFOAM/global/argList/argListI.H
+++ b/src/OpenFOAM/global/argList/argListI.H
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2013 OpenFOAM Foundation
-    Copyright (C) 2017-2020 OpenCFD Ltd.
+    Copyright (C) 2017-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -221,7 +221,7 @@ namespace Foam
     template<>
     inline fileName argList::get<Foam::fileName>(const label index) const
     {
-        return args_[index];
+        return fileName::validate(args_[index]);
     }
 
 
@@ -240,7 +240,7 @@ namespace Foam
     template<>
     inline fileName argList::get<Foam::fileName>(const word& optName) const
     {
-        return options_[optName];
+        return fileName::validate(options_[optName]);
     }
 }
 
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C
index 2905d6fbc281b33a9ce7ad8d68e664a49392951b..09ebe26f3a9e19a6e358f842524e793d7dddb080 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.C
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2019 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -52,72 +52,164 @@ int Foam::fileName::allowSpaceInFileName
 const Foam::fileName Foam::fileName::null;
 
 
-// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
 
-Foam::fileName Foam::fileName::validate
+namespace
+{
+
+// doClean:
+//   - remove duplicate slashes, "/./" and "/../" components.
+//
+// checkValid:
+//   - similar to stripInvalid (but silent)
+//
+// return True if the content changed
+static bool cleanFileName
 (
-    const std::string& s,
-    const bool doClean
+    std::string& str,
+    const bool doClean,
+    const bool checkValid
 )
 {
-    // The logic is very similar to stripInvalid,
-    // but silently removes bad characters
-
-    fileName out;
-    out.resize(s.length());
-
-    std::string::size_type len = 0;
-
-    auto iter = s.cbegin();
+    const auto maxLen = str.length();
+    std::string::size_type nChar = 0;
 
-    #ifdef _WIN32
-    // Preserve UNC \\server-name\...
-    if (s.length() > 2 && s[0] == '\\' && s[1] == '\\')
+    // Preserve UNC \\server\path (windows)
+    // - MS-windows only, but handle for other systems
+    //   since there is no collision with this pattern
+    if (maxLen > 2 && str[0] == '\\' && str[1] == '\\')
     {
-        len += 2;
-        ++iter;
-        ++iter;
+        nChar += 2;
     }
-    #endif
 
     char prev = 0;
-    for (/*nil*/; iter != s.cend(); ++iter)
-    {
-        char c = *iter;
+    auto top = std::string::npos;  // Not yet found
+    bool changed = false;
 
-        // Treat raw backslash like a path separator. There is no "normal"
-        // way for these to be there (except for an OS that uses them), but
-        // could also cause issues when writing strings, shell commands etc.
+    for (auto src = nChar; src < maxLen; /*nil*/)
+    {
+        char c = str[src++];
 
+        // Treat raw backslash like a path separator.
+        // There is no "normal" way for these to be there
+        // (except for an OS that uses them), but can cause issues
+        // when writing strings, shell commands etc.
         if (c == '\\')
         {
             c = '/';
+            str[nChar] = c;
+            changed = true;
+        }
+        else if (checkValid && !Foam::fileName::valid(c))
+        {
+            // Ignore invalid chars
+            // Could explicitly allow space character or rely on
+            // allowSpaceInFileName via fileName::valid()
+            continue;
         }
 
-        // Could explicitly allow space character or rely on
-        // allowSpaceInFileName via fileName::valid()
+        if (c == '/' && top == std::string::npos)
+        {
+            // Top-level slash not previously determined
+            top = (src-1);
+        }
 
-        if (fileName::valid(c))
+        if (doClean && prev == '/')
         {
-            if (doClean && prev == '/' && c == '/')
+            // Repeated '/' - skip it
+            if (c == '/')
             {
-                // Avoid repeated '/';
                 continue;
             }
 
-            // Only track valid chars
-            out[len++] = prev = c;
+            // Could be "/./", "/../" or a trailing "/."
+            if (c == '.')
+            {
+                // Trailing "/." - skip it
+                if (src >= maxLen)
+                {
+                    break;
+                }
+
+                // Peek at the next character
+                const char c1 = str[src];
+
+                // Found "/./" - skip over it
+                if (c1 == '/' || c1 == '\\')
+                {
+                    ++src;
+                    continue;
+                }
+
+                // Trailing "/.." or intermediate "/../"
+                if
+                (
+                    c1 == '.'
+                 &&
+                    (
+                        src+1 >= maxLen
+                     || str[src+1] == '/' || str[src+1] == '\\'
+                    )
+                )
+                {
+                    // Backtrack to find the parent directory
+                    // Minimum of 3 characters:  '/x/../'
+                    // Strip it, provided it is above the top point
+
+                    std::string::size_type parent;
+                    if
+                    (
+                        nChar > 2
+                     && top != std::string::npos
+                     && (parent = str.rfind('/', nChar-2)) != std::string::npos
+                     && parent >= top
+                    )
+                    {
+                        nChar = parent + 1;   // Retain '/' from the parent
+                        src += 2;
+                        continue;
+                    }
+
+                    // Bad resolution, eg 'abc/../../'
+                    // Retain the sequence, but move the top to avoid it being
+                    // considered a valid parent later
+                    top = nChar + 2;
+                }
+            }
         }
+
+        str[nChar++] = prev = c;
     }
 
-    if (doClean && prev == '/' && len > 1)
+    // Remove trailing '/'
+    if (doClean && nChar > 1 && str[nChar-1] == '/')
     {
-        // Avoid trailing '/'
-        --len;
+        --nChar;
     }
 
-    out.resize(len);
+    str.erase(nChar);
+    return changed || (nChar != maxLen);
+}
+
+} // End namespace Foam
 
+
+// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
+
+bool Foam::fileName::clean(std::string& str)
+{
+    return cleanFileName(str, true, false);  // clean, checkValid = false
+}
+
+
+Foam::fileName Foam::fileName::validate
+(
+    const std::string& str,
+    const bool doClean
+)
+{
+    fileName out(str, false);           // copy, no stripping
+    cleanFileName(out, doClean, true);  // checkValid = true
     return out;
 }
 
@@ -288,117 +380,19 @@ Foam::fileName& Foam::fileName::toAbsolute()
     {
         fileName& f = *this;
         f = cwd()/f;
-        f.clean();
+        f.clean();  // Remove unneeded ".."
     }
 
     return *this;
 }
 
 
-bool Foam::fileName::clean(std::string& str)
-{
-    // Start with the top slash found - we are never allowed to go above it
-    char prev = '/';
-    auto top = str.find(prev);
-
-    // No slashes - nothing to do
-    if (top == std::string::npos)
-    {
-        return false;
-    }
-
-    // Number of output characters
-    auto nChar = top+1;
-
-    const auto maxLen = str.length();
-
-    for (auto src = nChar; src < maxLen; /*nil*/)
-    {
-        const char c = str[src++];
-
-        if (prev == '/')
-        {
-            // Repeated '/' - skip it
-            if (c == '/')
-            {
-                continue;
-            }
-
-            // Could be "/./", "/../" or a trailing "/."
-            if (c == '.')
-            {
-                // Trailing "/." - skip it
-                if (src >= maxLen)
-                {
-                    break;
-                }
-
-                // Peek at the next character
-                const char c1 = str[src];
-
-                // Found "/./" - skip it
-                if (c1 == '/')
-                {
-                    ++src;
-                    continue;
-                }
-
-                // Trailing "/.." or intermediate "/../"
-                if (c1 == '.' && (src+1 >= maxLen || str[src+1] == '/'))
-                {
-                    string::size_type parent;
-
-                    // Backtrack to find the parent directory
-                    // Minimum of 3 characters:  '/x/../'
-                    // Strip it, provided it is above the top point
-                    if
-                    (
-                        nChar > 2
-                     && (parent = str.rfind('/', nChar-2)) != string::npos
-                     && parent >= top
-                    )
-                    {
-                        nChar = parent + 1;   // Retain '/' from the parent
-                        src += 2;
-                        continue;
-                    }
-
-                    // Bad resolution, eg 'abc/../../'
-                    // Retain the sequence, but move the top to avoid it being
-                    // considered a valid parent later
-                    top = nChar + 2;
-                }
-            }
-        }
-        str[nChar++] = prev = c;
-    }
-
-    // Remove trailing slash
-    if (nChar > 1 && str[nChar-1] == '/')
-    {
-        nChar--;
-    }
-
-    str.resize(nChar);
-
-    return (nChar != maxLen);
-}
-
-
 bool Foam::fileName::clean()
 {
     return fileName::clean(*this);
 }
 
 
-Foam::fileName Foam::fileName::clean() const
-{
-    fileName cleaned(*this);
-    fileName::clean(cleaned);
-    return cleaned;
-}
-
-
 std::string Foam::fileName::nameLessExt(const std::string& str)
 {
     auto beg = str.rfind('/');
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H
index 78f851d2a7cb448625ea0b731b99e3f109d9bdd0..b00c78e8049cd6cd375cbd6b69813f9bbdb22a41 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileName.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H
@@ -151,10 +151,10 @@ public:
         //- Is this character valid for a fileName?
         inline static bool valid(char c);
 
-        //- Construct fileName with no invalid characters, possibly applying
+        //- Construct fileName without invalid characters, possibly applying
         //- other transformations such as changing the path separator,
         //- removing duplicate or trailing slashes, etc.
-        static fileName validate(const std::string& s, const bool doClean=true);
+        static fileName validate(const std::string&, const bool doClean=true);
 
         //- Join two strings with a path separator ('/' by default).
         //  No separator is added if either argument is an empty string or
@@ -174,44 +174,48 @@ public:
         //- Strip invalid characters
         inline void stripInvalid();
 
-        //- Cleanup filename
+        //- Cleanup filename string, possibly applies other transformations
+        //- such as changing the path separator etc.
         //
-        // Removes trailing \c /
-        //   \verbatim
-        //       /                 -->   /
-        //       /abc/             -->   /abc
-        //   \endverbatim
+        // Changes back-slash to forward-slash path separator,
+        // while preserving windows UNC:
+        // \verbatim
+        //     \\server\abc\def  -->   \\server/abc/def
+        // \endverbatim
         //
-        // Removes repeated slashes
-        //   \verbatim
-        //       /abc////def        -->   /abc/def
-        //   \endverbatim
+        // Removes trailing slash:
+        // \verbatim
+        //     /                 -->   /
+        //     /abc/             -->   /abc
+        // \endverbatim
         //
-        // Removes \c /./ (current directory)
-        //   \verbatim
-        //       /abc/def/./ghi/.   -->   /abc/def/ghi
-        //       abc/def/./         -->   abc/def
-        //       ./abc/             -->   ./abc
-        //   \endverbatim
+        // Removes repeated slashes, but preserves UNC:
+        // \verbatim
+        //     /abc////def          -->   /abc/def
+        //     \\server\abc////def  -->   \\server/abc/def
+        // \endverbatim
         //
-        // Removes \c /../ (parent directory)
-        //   \verbatim
-        //       /abc/def/../ghi/jkl/nmo/..   -->   /abc/ghi/jkl
-        //       abc/../def/ghi/../jkl        -->   abc/../def/jkl
-        //   \endverbatim
+        // Removes \c "/./" (current directory), except for leading one:
+        // \verbatim
+        //     /abc/def/./ghi/.   -->   /abc/def/ghi
+        //     abc/def/./         -->   abc/def
+        //     ./abc/             -->   ./abc
+        // \endverbatim
+        //
+        // Removes \c "/../" (parent directory), except for leading one:
+        // \verbatim
+        //     /abc/def/../ghi/jkl/nmo/..   -->   /abc/ghi/jkl
+        //     abc/../def/ghi/../jkl        -->   abc/../def/jkl
+        // \endverbatim
+        // .
         //
         // \return True if the content changed
         static bool clean(std::string& str);
 
-
-        //- Cleanup filename inplace
-        //  \return True if any contents changed
+        //- Cleanup filename (inplace)
+        //  \return True if the content changed
         bool clean();
 
-        //- Cleanup filename
-        //  \return cleaned copy of fileName
-        fileName clean() const;
-
 
     // Interrogation
 
@@ -223,10 +227,13 @@ public:
         //  \param checkGzip add an additional test for a gzip FILE
         Type type(bool followLink=true, bool checkGzip=false) const;
 
-        //- Return true if string starts with a '/'
+        //- Return true if filename starts with a '/' or '\\'
+        //- or (windows-only) with a filesystem-root
         inline static bool isAbsolute(const std::string& str);
 
-        //- Return true if file name is absolute (starts with a '/')
+        //- Return true if filename is absolute,
+        //- which means it starts with a '/' or '\\'
+        //- or (windows-only) with a filesystem-root
         inline bool isAbsolute() const;
 
         //- Convert from relative to absolute
diff --git a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
index f7fffcbc7e290863a35376a7b891bba2de6cbad4..ed1e860e455e0aba2e840f9de6e43d4c2264277f 100644
--- a/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
+++ b/src/OpenFOAM/primitives/strings/fileName/fileNameI.H
@@ -135,20 +135,22 @@ inline void Foam::fileName::stripInvalid()
 
 inline bool Foam::fileName::isAbsolute(const std::string& str)
 {
-    return
+    return !str.empty() &&
     (
-        (!str.empty() && str.front() == '/')  // ie, str.starts_with('/')
-        #ifdef _WIN32
-        ||
-        (
-            // Eg, d:/path or \\machine/path
-            (str.length() > 2) &&
-            (
-                (str[1] == ':'  && str[2] == '/')
-             || (str[0] == '\\' && str[1] == '\\')
-            )
+        // Starts with '/', but also accept '\\' since it will be
+        // converted to a generic '/' or it is part of a (windows)
+        // UNC '\\server-name\path'
+        // - accept even on non-windows systems
+
+        (str[0] == '/' || str[0] == '\\')
+
+#ifdef _WIN32
+         // Filesytem root - eg, d:/path or d:\path
+     || (
+            (str.length() > 2 && str[1] == ':')
+         && (str[2] == '/' || str[2] == '\\')
         )
-        #endif
+#endif
     );
 }
 
diff --git a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C
index 3aa139bb876cfd4a11332e15f40c6b52d60004ad..30fc454607fe00c142e75705e4c9c4f643b0c498 100644
--- a/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C
+++ b/src/finiteVolume/fvMesh/fvGeometryScheme/averageNeighbour/averageNeighbourFvGeometryScheme.C
@@ -699,13 +699,13 @@ void Foam::averageNeighbourFvGeometryScheme::movePoints()
 
 
             // Write current non-ortho
-            fileName outputDir =
+            fileName outputDir
             (
                 mesh_.time().globalPath()
               / functionObject::outputPrefix
               / mesh_.pointsInstance()
             );
-            outputDir.clean();
+            outputDir.clean();  // Remove unneeded ".."
             writerPtr = surfaceWriter::New
             (
                 "ensight" //"vtk"
diff --git a/src/functionObjects/field/externalCoupled/externalCoupled.C b/src/functionObjects/field/externalCoupled/externalCoupled.C
index 3760669f01fae3fe49e72ae46d45e6168a6eba65..18706366ebb1906caad87554c7d4a0954320965f 100644
--- a/src/functionObjects/field/externalCoupled/externalCoupled.C
+++ b/src/functionObjects/field/externalCoupled/externalCoupled.C
@@ -5,7 +5,7 @@
     \\  /    A nd           | www.openfoam.com
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
-    Copyright (C) 2015-2020 OpenCFD Ltd.
+    Copyright (C) 2015-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -90,10 +90,10 @@ Foam::fileName Foam::functionObjects::externalCoupled::groupDir
     fileName result
     (
         commsDir
-       /regionGroupName
-       /string::validate<fileName>(groupName)
+      / regionGroupName
+      / word::validate(groupName)
     );
-    result.clean();
+    result.clean();  // Remove unneeded ".."
 
     return result;
 }
diff --git a/src/functionObjects/lagrangian/dataCloud/dataCloud.C b/src/functionObjects/lagrangian/dataCloud/dataCloud.C
index 1c91d52f3ae2d450ef02e98f6b89f34f34458868..c7ec4df888acc8fd7bc2e5edfde518d8db217482 100644
--- a/src/functionObjects/lagrangian/dataCloud/dataCloud.C
+++ b/src/functionObjects/lagrangian/dataCloud/dataCloud.C
@@ -195,7 +195,7 @@ bool Foam::functionObjects::dataCloud::read(const dictionary& dict)
         // Standard postProcessing/ naming
         directory_ = time_.globalPath()/functionObject::outputPrefix/name();
     }
-    directory_.clean();
+    directory_.clean();  // Remove unneeded ".."
 
     return true;
 }
diff --git a/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C b/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C
index deba0c5e5fc8a773775fc9665b8d768ed2268f21..b56c72db3c1253736e960d00c59fa86305f07e21 100644
--- a/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C
+++ b/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C
@@ -449,7 +449,7 @@ bool Foam::functionObjects::vtkCloud::read(const dictionary& dict)
         // Standard postProcessing/ naming
         directory_ = time_.globalPath()/functionObject::outputPrefix/name();
     }
-    directory_.clean();
+    directory_.clean();  // Remove unneeded ".."
 
     return true;
 }
diff --git a/src/functionObjects/utilities/abort/abort.C b/src/functionObjects/utilities/abort/abort.C
index 7f0a5603888ad766b075d818c8cb63ae188ac8f4..c8a8e0d531d90d81d14816d9370457018277ec6b 100644
--- a/src/functionObjects/utilities/abort/abort.C
+++ b/src/functionObjects/utilities/abort/abort.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2016-2020 OpenCFD Ltd.
+    Copyright (C) 2016-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -167,11 +167,10 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
     if (dict.readIfPresent("file", file_))
     {
         file_.expand();
-
-        if (!file_.isAbsolute() && file_.size())
+        if (!file_.empty() && !file_.isAbsolute())
         {
             file_ = time_.globalPath()/file_;
-            file_.clean();
+            file_.clean();  // Remove unneeded ".."
         }
     }
 
@@ -179,7 +178,7 @@ bool Foam::functionObjects::abort::read(const dictionary& dict)
     if (file_.empty())
     {
         file_ = time_.globalPath()/name();
-        file_.clean();
+        file_.clean();  // Remove unneeded ".."
     }
 
     triggered_ = false;
diff --git a/src/functionObjects/utilities/ensightWrite/ensightWrite.C b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
index 7131e34fc6b475abd2bcf78ef95f0fbfb827aa0a..36a3b53d18592091e8bbb52f7365fb3448842dc7 100644
--- a/src/functionObjects/utilities/ensightWrite/ensightWrite.C
+++ b/src/functionObjects/utilities/ensightWrite/ensightWrite.C
@@ -175,7 +175,7 @@ bool Foam::functionObjects::ensightWrite::read(const dictionary& dict)
         // Standard postProcessing/ naming
         outputDir_ = time_.globalPath()/functionObject::outputPrefix/name();
     }
-    outputDir_.clean();
+    outputDir_.clean();  // Remove unneeded ".."
 
     return true;
 }
diff --git a/src/functionObjects/utilities/vtkWrite/vtkWrite.C b/src/functionObjects/utilities/vtkWrite/vtkWrite.C
index 7e0ca767acecfe940903f68a5fbb94ee8ade7f3c..851f4a99f474ce18f52e780a6581667916633985 100644
--- a/src/functionObjects/utilities/vtkWrite/vtkWrite.C
+++ b/src/functionObjects/utilities/vtkWrite/vtkWrite.C
@@ -236,7 +236,7 @@ bool Foam::functionObjects::vtkWrite::read(const dictionary& dict)
         // Standard postProcessing/ naming
         outputDir_ = time_.globalPath()/functionObject::outputPrefix/name();
     }
-    outputDir_.clean();
+    outputDir_.clean();  // Remove unneeded ".."
 
     return true;
 }
diff --git a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C
index 7e4ea215fbfbb8aa98f847f758e23a5b1d22cd1d..089329248057a5dd91ae96a34bd4f1fbecee4ebe 100644
--- a/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C
+++ b/src/fvOptions/sources/derived/rotorDiskSource/bladeModel/bladeModel.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2016 OpenFOAM Foundation
-    Copyright (C) 2020 OpenCFD Ltd.
+    Copyright (C) 2020-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -36,7 +36,7 @@ License
 
 bool Foam::bladeModel::readFromFile() const
 {
-    return fName_ != fileName::null;
+    return !fName_.empty();
 }
 
 
@@ -96,7 +96,7 @@ Foam::bladeModel::bladeModel(const dictionary& dict)
     radius_(),
     twist_(),
     chord_(),
-    fName_(fileName::null)
+    fName_()
 {
     List<Tuple2<word, vector>> data;
     if (readFromFile())
diff --git a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C
index b47afe831f0f0c78e826e3cd76ca16f62cb1489b..41de57780e3f719303040c12a4920cf794aee55c 100644
--- a/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C
+++ b/src/fvOptions/sources/derived/rotorDiskSource/profileModel/profileModel.C
@@ -6,7 +6,7 @@
      \\/     M anipulation  |
 -------------------------------------------------------------------------------
     Copyright (C) 2011-2017 OpenFOAM Foundation
-    Copyright (C) 2019-2020 OpenCFD Ltd.
+    Copyright (C) 2019-2021 OpenCFD Ltd.
 -------------------------------------------------------------------------------
 License
     This file is part of OpenFOAM.
@@ -42,7 +42,7 @@ namespace Foam
 
 bool Foam::profileModel::readFromFile() const
 {
-    return fName_ != fileName::null;
+    return !fName_.empty();
 }
 
 
diff --git a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
index e8ef067ef1f29cbfc367ceb319a8843b52a4d0c4..5be91fd952cd5df2787bd04c1182db42f6f48be9 100644
--- a/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
+++ b/src/mesh/snappyHexMesh/meshRefinement/meshRefinement.C
@@ -2559,10 +2559,12 @@ Foam::label Foam::meshRefinement::findRegions
                 if (Pstream::master())
                 {
                     outputDir =
+                    (
                         mesh.time().globalPath()
                       / functionObject::outputPrefix
-                      / mesh.pointsInstance();
-                    outputDir.clean();
+                      / mesh.pointsInstance()
+                    );
+                    outputDir.clean();  // Remove unneeded ".."
                     mkDir(outputDir);
                 }
 
diff --git a/src/meshTools/coupling/externalFileCoupler.C b/src/meshTools/coupling/externalFileCoupler.C
index 0cae8f6dcd3e14a58bb0d1cb6795bbbe650dad14..722322dc14901c550ac0cb45b3183c753769d1c3 100644
--- a/src/meshTools/coupling/externalFileCoupler.C
+++ b/src/meshTools/coupling/externalFileCoupler.C
@@ -103,7 +103,7 @@ Foam::externalFileCoupler::externalFileCoupler()
     log(false)
 {
     commsDir_.expand();
-    commsDir_.clean();
+    commsDir_.clean();  // Remove unneeded ".."
 }
 
 
@@ -118,7 +118,7 @@ Foam::externalFileCoupler::externalFileCoupler(const fileName& commsDir)
     log(false)
 {
     commsDir_.expand();
-    commsDir_.clean();
+    commsDir_.clean();  // Remove unneeded ".."
 
     if (Pstream::master())
     {
@@ -158,7 +158,7 @@ bool Foam::externalFileCoupler::readDict(const dictionary& dict)
     {
         dict.readEntry("commsDir", commsDir_);
         commsDir_.expand();
-        commsDir_.clean();
+        commsDir_.clean();  // Remove unneeded ".."
         statusDone_ = dict.getOrDefault<word>("statusDone", "done");
         slaveFirst_ = dict.getOrDefault("initByExternal", false);
 
diff --git a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C
index 626341fcd584b2ec5c8f34d0d809e039ad9e595d..53baa17294470554ca8430ef36151ac010c4632c 100644
--- a/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C
+++ b/src/meshTools/mappedPatches/mappedPolyPatch/mappedPatchBase.C
@@ -1760,14 +1760,15 @@ Foam::pointIndexHit Foam::mappedPatchBase::facePoint
 const Foam::objectRegistry& Foam::mappedPatchBase::subRegistry
 (
     const objectRegistry& obr,
-    const fileName& rawFName
+    const fileName& path
 )
 {
-    // Lookup (and create if non existing) a registry using a '/' separated
-    // path.
+    // Lookup (and create if non-existing) a registry using
+    // '/' separated path. Like 'mkdir -p'
 
-    const fileName fName(rawFName.clean());
-    const wordList names(fName.components());
+    fileName cleanedPath(path);
+    cleanedPath.clean();  // Remove unneeded ".."
+    const wordList names(cleanedPath.components());
 
     if (names.empty())
     {
diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C
index bce791da89acf396b0efa19cda3bd028a8e0b5f0..63b0222af6e3d45b241e53df80966ac82da91b10 100644
--- a/src/sampling/probes/probes.C
+++ b/src/sampling/probes/probes.C
@@ -208,14 +208,13 @@ Foam::label Foam::probes::prepare()
         // Put in undecomposed case
         // (Note: gives problems for distributed data running)
 
-        fileName probeDir =
+        fileName probeDir
         (
             mesh_.time().globalPath()
           / functionObject::outputPrefix
           / probeSubDir
           / mesh_.time().timeName()
         );
-
         probeDir.clean();  // Remove unneeded ".."
 
         // ignore known fields, close streams for fields that no longer exist
diff --git a/src/sampling/sampledSet/shortestPath/shortestPathSet.C b/src/sampling/sampledSet/shortestPath/shortestPathSet.C
index cd5f1c85f7b9be46c78813bd84a55e07693d8be9..32ae511e8b623a0af079ef36846e1fcfa68b0b01 100644
--- a/src/sampling/sampledSet/shortestPath/shortestPathSet.C
+++ b/src/sampling/sampledSet/shortestPath/shortestPathSet.C
@@ -1316,13 +1316,13 @@ Foam::shortestPathSet::shortestPathSet
 {
     if (debug)
     {
-        fileName outputDir =
+        fileName outputDir
         (
             mesh.time().globalPath()
           / functionObject::outputPrefix
           / mesh.pointsInstance()
         );
-        outputDir.clean();
+        outputDir.clean();  // Remove unneeded ".."
 
         Info<< "shortestPathSet : Writing blocked faces to "
             << outputDir << endl;
diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
index df310b37cd3dd5795008c59b949aa33e69f1384f..3605b16296e4460620a1b6d310770de2fe1e530c 100644
--- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
+++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemkinReader/chemkinReader.C
@@ -871,7 +871,7 @@ Foam::chemkinReader::chemkinReader
     fileName chemkinFile(thermoDict.get<fileName>("CHEMKINFile"));
     chemkinFile.expand();
 
-    fileName thermoFile = fileName::null;
+    fileName thermoFile;
     thermoDict.readIfPresent("CHEMKINThermoFile", thermoFile);
     thermoFile.expand();
 
@@ -887,7 +887,7 @@ Foam::chemkinReader::chemkinReader
             chemkinFile = relPath/chemkinFile;
         }
 
-        if (thermoFile != fileName::null && !thermoFile.isAbsolute())
+        if (!thermoFile.empty() && !thermoFile.isAbsolute())
         {
             thermoFile = relPath/thermoFile;
         }