diff --git a/CHANGELIST.md b/CHANGELIST.md
index 9f4ff5cb..f2ff5314 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -130,6 +130,7 @@
- Possibly fix PIC parsing
- Add PS3 folder/file checks for detection
- Use default directory for folder browsing, if possible
+- Add unused command filename parser
### 2.3 (2022-02-05)
- Start overhauling Redump information pulling, again
diff --git a/MPF.Modules/DiscImageCreator/Parameters.cs b/MPF.Modules/DiscImageCreator/Parameters.cs
index 2ab2fdfb..935520ae 100644
--- a/MPF.Modules/DiscImageCreator/Parameters.cs
+++ b/MPF.Modules/DiscImageCreator/Parameters.cs
@@ -2402,6 +2402,34 @@ namespace MPF.Modules.DiscImageCreator
#region Private Extra Methods
+ ///
+ /// Get the command file path and extract the version from it
+ ///
+ /// Base filename and path to use for checking
+ /// Tuple of file path and version as strings, both null on error
+ private static (string, string) GetCommandFilePathAndVersion(string basePath)
+ {
+ // If we have an invalid base path, we can do nothing
+ if (string.IsNullOrWhiteSpace(basePath))
+ return (null, null);
+
+ // Generate the matching regex based on the base path
+ string basePathFileName = Path.GetFileName(basePath);
+ Regex cmdFilenameRegex = new Regex(Regex.Escape(basePathFileName) + @"_(\d{8})T\d{6}\.txt");
+
+ // Find the first match for the command file
+ string parentDirectory = Path.GetDirectoryName(basePath);
+ var currentFiles = Directory.GetFiles(parentDirectory);
+ string commandPath = currentFiles.FirstOrDefault(f => cmdFilenameRegex.IsMatch(f));
+ if (string.IsNullOrWhiteSpace(commandPath))
+ return (null, null);
+
+ // Extract the version string
+ var match = cmdFilenameRegex.Match(commandPath);
+ string version = match.Groups[1].Value;
+ return (commandPath, version);
+ }
+
///
/// Set the DIC command to be used for a given system and media type
///