#include "MisrFileQuery.h"
#include "MisrError.h"
#include <stdio.h>
#include <sys/stat.h>
#include <string.h>
#include <dirent.h>
#include <unistd.h>
#include <regex.h>
Go to the source code of this file.
|
static void | findfile (const regex_t *preg, int *count, int *max, char ***file_list, MTKt_status *status) |
|
MTKt_status | MtkFindFileList (const char *searchdir, const char *product, const char *camera, const char *path, const char *orbit, const char *version, int *filecnt, char **filenames[]) |
| Find files in a directory tree, using regular expressions. More...
|
|
◆ FILE_LIST_SIZE
#define FILE_LIST_SIZE 20 /* Size to extend file list by */ |
◆ MAX_DIR_PATH
#define MAX_DIR_PATH 2048 /* maximal full path we support. */ |
◆ REG_BASIC
◆ S_ISDIR
#define S_ISDIR |
( |
|
x | ) |
(((x) & S_IFMT) == S_IFDIR) |
◆ findfile()
◆ MtkFindFileList()
Find files in a directory tree, using regular expressions.
- Returns
- MTK_SUCCESS if successful.
- Example:
- In this example, we search the directory
misr_products
for all GRP files related to the DF camera.
status =
MtkFindFileList(
"misr_products",
"GRP.*",
"DF",
".*",
".*",
".*", &filecnt, &filenames);
- Note
- The caller is responsible for using MtkStringListFree() to free the memory used by
filenames
- Parameters
-
[in] | searchdir | Search Directory |
[in] | product | Product |
[in] | camera | Camera |
[in] | path | Path |
[in] | orbit | Orbit |
[in] | version | Version |
[out] | filecnt | File count |
[out] | filenames | Filenames |
Definition at line 68 of file MtkFindFileList.c.