MISR Toolkit  1.5.1
Macros | Functions
MtkFindFileList.c File Reference
#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.

Macros

#define S_ISDIR(x)   (((x) & S_IFMT) == S_IFDIR)
 
#define REG_BASIC   0
 
#define MAX_DIR_PATH   2048 /* maximal full path we support. */
 
#define FILE_LIST_SIZE   20 /* Size to extend file list by */
 

Functions

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...
 

Macro Definition Documentation

◆ FILE_LIST_SIZE

#define FILE_LIST_SIZE   20 /* Size to extend file list by */

Definition at line 46 of file MtkFindFileList.c.

◆ MAX_DIR_PATH

#define MAX_DIR_PATH   2048 /* maximal full path we support. */

Definition at line 45 of file MtkFindFileList.c.

◆ REG_BASIC

#define REG_BASIC   0

Definition at line 42 of file MtkFindFileList.c.

◆ S_ISDIR

#define S_ISDIR (   x)    (((x) & S_IFMT) == S_IFDIR)

Definition at line 38 of file MtkFindFileList.c.

Function Documentation

◆ findfile()

static void findfile ( const regex_t preg,
int *  count,
int *  max,
char ***  file_list,
MTKt_status status 
)
static

Definition at line 185 of file MtkFindFileList.c.

◆ MtkFindFileList()

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.

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]searchdirSearch Directory
[in]productProduct
[in]cameraCamera
[in]pathPath
[in]orbitOrbit
[in]versionVersion
[out]filecntFile count
[out]filenamesFilenames

Definition at line 68 of file MtkFindFileList.c.


MISR Toolkit - Copyright © 2005 - 2020 Jet Propulsion Laboratory
Generated on Fri Jun 19 2020 22:49:53