SDDSlib
|
Utility functions for date handling and file operations. More...
Go to the source code of this file.
Functions | |
short | make_four_digit_year (short year) |
Converts a two-digit year into a four-digit year. | |
long | is_leap_year (short year) |
char ** | ls_dir (char *path, char *matchstr, long tailsOnly, long *files) |
char ** | find_files_between_dates (char *directory, char *rootname, char *suffix, short startYear, short startMonth, short startDay, short startJDay, short endYear, short endMonth, short endDay, short endJDay, char *filter, char **extensionList, long extensions, long tailsOnly, long *files, long increaseOrder) |
Finds files in a directory that match specified criteria within a date range. | |
void | sort_files_by_start_time (char *directory, long isTail, char **fileList, long files, long increaseOrder) |
Utility functions for date handling and file operations.
This file provides functions for converting two-digit years to four-digit years, determining leap years, listing files in directories, finding files within date ranges, and sorting files based on their 'StartTime' parameter.
Definition in file find_files.c.
char ** find_files_between_dates | ( | char * | directory, |
char * | rootname, | ||
char * | suffix, | ||
short | startYear, | ||
short | startMonth, | ||
short | startDay, | ||
short | startJDay, | ||
short | endYear, | ||
short | endMonth, | ||
short | endDay, | ||
short | endJDay, | ||
char * | filter, | ||
char ** | extensionList, | ||
long | extensions, | ||
long | tailsOnly, | ||
long * | files, | ||
long | increaseOrder ) |
Finds files in a directory that match specified criteria within a date range.
directory | The directory to search for files. |
rootname | The root name of the files to match. |
suffix | The suffix of the files to match (can be NULL). |
startYear | The starting year (can be two-digit or four-digit). |
startMonth | The starting month. |
startDay | The starting day. |
startJDay | The starting Julian day (if zero, it will be calculated from startYear, startMonth, startDay). |
endYear | The ending year (can be two-digit or four-digit). |
endMonth | The ending month. |
endDay | The ending day. |
endJDay | The ending Julian day (if zero, it will be calculated from endYear, endMonth, endDay). |
filter | The filter pattern to match files against. |
extensionList | An array of strings containing file extensions to match (can be NULL). |
extensions | The number of extensions in extensionList. |
tailsOnly | If non-zero, only the filenames are returned; otherwise, full paths are included. |
files | Pointer to a long where the number of files found will be stored. |
increaseOrder | If non-zero, the files are returned in increasing order; otherwise, in decreasing order. |
This function searches the specified directory for files that match the given rootname, suffix, date range, and filter pattern. It supports multiple file extensions and can return files in either increasing or decreasing order based on the start time parameter in the files.
Definition at line 115 of file find_files.c.
long is_leap_year | ( | short | year | ) |
Definition at line 34 of file find_files.c.
char ** ls_dir | ( | char * | path, |
char * | matchstr, | ||
long | tailsOnly, | ||
long * | files ) |
Definition at line 43 of file find_files.c.
short make_four_digit_year | ( | short | year | ) |
Converts a two-digit year into a four-digit year.
year | The input year, possibly two-digit. |
If the input year is greater than 100, it is assumed to already be a four-digit year and is returned as is. If the input year is less than 90, it is assumed to be in the 2000s and 2000 is added. Otherwise, it is assumed to be in the 1900s and 1900 is added.
Definition at line 22 of file find_files.c.
void sort_files_by_start_time | ( | char * | directory, |
long | isTail, | ||
char ** | fileList, | ||
long | files, | ||
long | increaseOrder ) |
Definition at line 275 of file find_files.c.