Find existing files matching specified criteria.
Example with text spec token (x):
string site("FOO");
std::list<std::string> fileList =
gnsstk::FileSpecFind::find(
"/data/%04Y/%05n/%03j/nsh-%x-%5n-%1r-%04Y-%03j-%02H%02M%02S.xml", fromTime, toTime, textStore);
Example without text spec token:
"/archive/%04Y/%05n/%05n-%04Y%03j-%1r%1t.raw",
fromTime, toTime, fsts);
Definition at line 83 of file FileSpecFind.hpp.
#include <FileSpecFind.hpp>
|
static std::list< std::string > | find (const FileSpec &fileSpec, const CommonTime &start, const CommonTime &end, const FileSpec::FSTStringMap &fsts=FileSpec::FSTStringMap()) |
|
static std::list< std::string > | find (const FileSpec &fileSpec, const CommonTime &start, const CommonTime &end, const Filter &filter) |
|
static std::list< std::string > | find (const std::string &fileSpec, const CommonTime &start, const CommonTime &end, const FileSpec::FSTStringMap &fsts=FileSpec::FSTStringMap()) |
|
static std::list< std::string > | find (const std::string &fileSpec, const CommonTime &start, const CommonTime &end, const Filter &filter) |
|
◆ Filter
◆ find() [1/4]
Search for existing files matching a given file spec and time range. May be used for file spec strings that contain (non-time) tokens with no width specified, provided specific values are added to fsts to fix the width.
- Parameters
-
[in] | fileSpec | The FileSpec that the files should match. |
[in] | start | Files/directories that precede this time will be ignored. |
[in] | end | Files/directories that are after this time will be ignored. |
[in] | fsts | Filler values for fileSpec that have no fixed width. For example, "text" tokens may have no width specified in fileSpec, e.g. "%x", in which case a value should be added here to derive a length from. |
- Warning
- You will not get any matches for file names that contain tokens with no width (e.g. "%x") if you do not specify a text value in fsts.
- Returns
- A list of matching file names.
Definition at line 116 of file FileSpecFind.hpp.
◆ find() [2/4]
Search for existing files matching a given file spec, time range, and set of allowed FileSpec token values.
- Parameters
-
[in] | fileSpec | The FileSpec that the files should match. |
[in] | start | Files/directories that precede this time will be ignored. |
[in] | end | Files/directories that are after this time will be ignored. |
[in] | filter | Set of allowable values for tokens present in fileSpec (values for tokens not present will be ignored). |
- Returns
- A list of matching file names.
Definition at line 143 of file FileSpecFind.hpp.
◆ find() [3/4]
Search for existing files matching a given file spec and time range. May be used for file spec strings that contain (non-time) tokens with no width specified, provided specific values are added to fsts to fix the width.
- Parameters
-
[in] | fileSpec | The FileSpec that the files should match. |
[in] | start | Files/directories that precede this time will be ignored. |
[in] | end | Files/directories that are after this time will be ignored. |
[in] | fsts | Filler values for fileSpec that have no fixed width. For example, "text" tokens may have no width specified in fileSpec, e.g. "%x", in which case a value should be added here to derive a length from. |
- Warning
- You will not get any matches for file names that contain tokens with no width (e.g. "%x") if you do not specify a text value in fsts.
- Returns
- A list of matching file names.
Definition at line 225 of file FileSpecFind.cpp.
◆ find() [4/4]
Search for existing files matching a given file spec, time range, and set of allowed FileSpec token values.
- Parameters
-
[in] | fileSpec | The FileSpec that the files should match. |
[in] | start | Files/directories that precede this time will be ignored. |
[in] | end | Files/directories that are after this time will be ignored. |
[in] | filter | Set of allowable values for tokens present in fileSpec (values for tokens not present will be ignored). |
- Returns
- A list of matching file names.
Definition at line 283 of file FileSpecFind.cpp.
◆ findGlob()
Recursive (into subdirectories) function for find that uses glob. Look at the .cpp file for a more detailed description of how this works.
- Parameters
-
[in] | start | Files/directories that precede this time will be ignored. |
[in] | end | Files/directories that are after this time will be ignored. |
[in] | spec | The string representation of the FileSpec that the files should match. |
[in] | dummyFSTS | Filler values for the file spec when creating dummy file names to get appropriate time ranges. |
[in] | matched | A string containing already-matched paths when recursion occurs. This string replaces spec[0] through spec[pos] when doing searches. |
[in] | pos | Starting position (from 0) into spec to start looking for FileSpec tokens. Used to support recursion. |
- Returns
- A list of matching file names.
Definition at line 474 of file FileSpecFind.cpp.
◆ transToken()
string gnsstk::FileSpecFind::transToken |
( |
const std::string & |
token | ) |
|
|
staticprivate |
Translates FileSpec formatting tokens into glob expressions.
- Parameters
-
[in] | token | A string containing FileSpec formatting tokens e.g. %04Y. |
- Returns
- a string with all of the known formatting tokens replaced with glob patterns that have a reasonable chance of matching names of existing files generated using the FileSpec. For example, %04Y would become [0-9][0-9][0-9][0-9]
Definition at line 308 of file FileSpecFind.cpp.
◆ ::FileSpecFind_T
The documentation for this class was generated from the following files: