Fine thanls dear friendYou can accomplish this task using a scripting language like Python. Here's a Python script that renames files in bulk according to your specifications:Make sure to replace "/path/to/your/directory" with the path to the directory containing your files.Code:
import osimport re# Define the directory containing the filesdirectory = "/path/to/your/directory"# Define the regex pattern to extract the number from the filenamepattern = re.compile(r"#Tableau Course #(\d{1,3})\.mkv$")# Iterate over each file in the directoryfor filename in os.listdir(directory): # Check if the file is an MKV file if filename.endswith(".mkv"): # Extract the number from the filename match = re.search(pattern, filename) if match: number = match.group(1) # Rename the file new_filename = f"{number.zfill(3)} {filename.replace('#Tableau Course #' + number, '').strip()}" os.rename(os.path.join(directory, filename), os.path.join(directory, new_filename)) print(f"Renamed {filename} to {new_filename}")
This script extracts the number from the filename using a regular expression, formats it to be zero-padded to 3 digits, and then inserts it at the beginning of the filename.




Att.
DruidCtba®.
Statistics: Posted by DruidCtba — 2024-04-30, 20:52 UTC