Truxton file export add criteria
Jump to navigation
Jump to search
This gives you the ability to specify criteria for selecting files to export from Truxton.
Syntax
void truxton_file_export_add_criteria(uint64_t export_handle, uint64_t field, char const * value);
Parameters
export_handle
The handle to an export instance created by the truxton_file_export_create() call.
field
Which criteria to set.
value
The string representation of the field criteria.
Sample
1 #include "TruxtonCAPI.h"
2 #pragma comment(lib, "TruxtonCAPI.lib")
3
4 #include "filetypes.h"
5 #include <stdlib.h>
6 #pragma hdrstop
7
8 int main()
9 {
10 char temporary_string[256];
11
12 truxton_start();
13
14 uint64_t truxton = truxton_create();
15
16 uint64_t export_handle = truxton_file_export_create(truxton);
17
18 // We want a variety of file types
19 sprintf_s(temporary_string, sizeof(temporary_string), "%d, %d, %d", Type_JPEGWithExif, Type_JPEG, Type_GIF);
20 truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_TYPE, temp_string);
21
22 // We only want files where the MD5 hash starts with "e4"
23 truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_HASH, "e4");
24
25 // We want a file that is at least 4MB long
26 truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MINIMUM, "4194304");
27
28 // We want a file that is no larger than 5MB
29 truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_SIZE_MAXIMUM, "5242880");
30
31 // Limit the output to a single file
32 truxton_file_export_add_criteria(export_handle, TRUXTON_EXPORT_FILE_QUERY_FIELD_LIMIT, "1");
33
34 truxton_file_export_where_clause(export_handle, temporary_string, sizeof(temporary_string));
35 printf( "Will use the following WHERE clause to select files: %s\n", temporary_string);
36
37 // Rename the file being exported to include the hash before the original name
38 truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_NAME_FORMAT, "{hash}_{name}");
39
40 // The files should be output to a particular folder
41 truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_FOLDER, "C:\\temp");
42
43 // We want them output to a TAR file in that particular folder
44 truxton_file_export_set_option(export_handle, TRUXTON_EXPORT_FILE_OPTION_TAR, "JPGWithExif.tar");
45
46 // Go find the files and output them to C:\temp\JPGWithExif.tar
47 truxton_file_export_execute(export_handle);
48
49 // Clean up
50 truxton_file_export_destroy(export_handle);
51 truxton_destroy(truxton);
52 truxton_stop();
53 }