From 29d75489b2aac59dad0bb48012ad72da45189a54 Mon Sep 17 00:00:00 2001 From: Brian Gregg Date: Wed, 3 Jun 2026 15:51:01 -0400 Subject: [PATCH 1/2] Updated get_file_info to handle files with multiple periods in their name. --- scan-batch-dir | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/scan-batch-dir b/scan-batch-dir index f474a2e..840757f 100755 --- a/scan-batch-dir +++ b/scan-batch-dir @@ -636,25 +636,28 @@ def process_unknown(file_path:str): def get_file_info(file_path: str): """ Obtain information about the file_path file. - Args: file_path (str) The Path to the file. - Returns: - pid (str) The PID of the file. + pid (str) The PID of the file (everything before the first period). parent (str) The parent directory of the file. file (str) The filename and extension of the file. dir (str) The directory that the file is located in. - ext (str) The file extension of the file. + ext (str) The file extension of the file (everything after the last period). """ - dir,ext = os.path.splitext(file_path) # Split the file_path into directory and extension. - file_name = os.path.basename(dir) # Get the file_name of the object which will usually be the pid. - pid = file_name # Assign pid to the last piece of the directory. - parent = os.path.basename(os.path.dirname(file_path)) dir = os.path.dirname(file_path) - file = f"{pid}{ext}" + full_name = os.path.basename(file_path) # e.g. "abc.def.ghi.txt" + parent = os.path.basename(dir) + + if '.' in full_name: + pid = full_name.split('.')[0] # Everything before the first period. + ext = '.' + full_name.rsplit('.', 1)[1] # Everything after the last period. + else: + pid = full_name + ext = '' - return(pid,parent,file,dir,ext) + file = full_name + return (pid, parent, file, dir, ext) def add_update_dataframe(df: pd.DataFrame, pid: str, row_data): From b737d7a87a7de903300ef25ade702fe4fd474d6e Mon Sep 17 00:00:00 2001 From: Brian Gregg Date: Fri, 17 Jul 2026 16:23:45 -0400 Subject: [PATCH 2/2] #4 Additional adjustment suggested by Claude.AI --- scan-batch-dir | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scan-batch-dir b/scan-batch-dir index 840757f..14245aa 100755 --- a/scan-batch-dir +++ b/scan-batch-dir @@ -800,7 +800,12 @@ def process_file(df: pd.DataFrame, file_path: str, level): file_folder = os.path.dirname(file_path) # The Full Path including Directory containing the file. base_name = os.path.basename(file_path) # The Base filename with extension of the file give the file_path. - file_name,file_ext = os.path.splitext(base_name)# The Separated Filename and Extension of the Base filename. + if '.' in base_name: + file_name = base_name.split('.')[0] # The Base filename without extension of the file give the file_path. + file_ext = '.' + base_name.rsplit('.', 1)[1] # The Extension of the file give the file_path. + else: + file_name = base_name + file_ext = '' # Set the file weight if the file_name is a digit or contains "-\d{4}" file_weight = '' @@ -883,6 +888,7 @@ def process_file(df: pd.DataFrame, file_path: str, level): # Override Row Data. # For transcription files just update the transcript column. row_data = { + 'id': pid, 'transcript': file_path }