I have this program in C++ (but even Python) which opens or creates a directory called file_path, scrolls each text file which goes along the Data_xyzw.txt format, finds the bigger xyzw and creates a name which is Data_abcd.txt where abcd = xyzw+1:
extern "C" void file_digits_finder (char* file_path){
//creating folder
int status = 0;
status = mkdir(file_path, S_IRWXU | S_IRWXO);
//getting names from all files in folder if already existent
uint higher_number = 0;
if (status==-1){
DIR *folder;
struct dirent *entry;
int files = 0;
folder = opendir(file_path);
assert(folder);
// All files will be of type: Data_xyzw, so 5 nondigit and 4 digits
while( (entry = readdir(folder)) ){
files++;
uint file_number = 0;
if ( isdigit(entry->d_name[5])!=0 && isdigit(entry->d_name[6])!=0 && isdigit(entry->d_name[7])!=0 && isdigit(entry->d_name[8])!=0){
string digits = to_string(entry->d_name[5]-48) + to_string(entry->d_name[6]-48) + to_string(entry->d_name[7]-48) + to_string(entry->d_name[8]-48) ;
file_number = stoi(digits);
}
if (higher_number < file_number){
higher_number = file_number;
}
//file will all be of the same name "Data" + a "file_number". We want to create a new file.
}
closedir(folder);
}
//decing file_number
previous_file_digits = higher_number;
}
How can I write this in julia?