mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
fileName: Added cpFiles function
//- Copy all the files from the source to the target directory void cpFiles(const fileName& srcDir, const fileName& targetDir);
This commit is contained in:
@ -50,13 +50,6 @@ class regIOobject;
|
||||
class objectRegistry;
|
||||
class Time;
|
||||
|
||||
// Description of processor directory naming:
|
||||
// - processor directory naming
|
||||
// - whether directory contains a range (so differs on different processors)
|
||||
// - index in range
|
||||
//typedef Tuple2<fileName, Tuple2<bool, label>> dirIndex;
|
||||
//typedef List<dirIndex> dirIndexList;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fileOperation Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -83,9 +76,16 @@ public:
|
||||
PROCBASEINSTANCE, // as PROCBASEOBJECT but with instance
|
||||
PROCINSTANCE // as PROCOBJECT but with instance
|
||||
};
|
||||
|
||||
static const NamedEnum<pathType, 12> pathTypeNames_;
|
||||
|
||||
//- Description of processor directory naming:
|
||||
// - processor directory naming
|
||||
// - whether directory contains a range
|
||||
// (so differs on different processors)
|
||||
// - index in range
|
||||
typedef Tuple2<fileName, Tuple2<pathType, label>> dirIndex;
|
||||
|
||||
typedef List<dirIndex> dirIndexList;
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -426,4 +426,17 @@ Foam::fileName Foam::search(const word& file, const fileName& directory)
|
||||
}
|
||||
|
||||
|
||||
void Foam::cpFiles(const fileName& srcDir, const fileName& targetDir)
|
||||
{
|
||||
mkDir(targetDir);
|
||||
|
||||
const fileNameList srcFiles(readDir(srcDir, fileName::FILE, true));
|
||||
|
||||
forAll(srcFiles, filei)
|
||||
{
|
||||
cp(srcDir/srcFiles[filei], targetDir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -242,12 +242,14 @@ public:
|
||||
//- Assemble words and fileNames as pathnames by adding a '/' separator
|
||||
fileName operator/(const string&, const string&);
|
||||
|
||||
|
||||
//- Recursively search the given directory for the file
|
||||
// returning the path relative to the directory or
|
||||
// fileName::null if not found
|
||||
fileName search(const word& file, const fileName& directory);
|
||||
|
||||
//- Copy all the files from the source to the target directory
|
||||
void cpFiles(const fileName& srcDir, const fileName& targetDir);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user