mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-25 12:49:26 +01:00
Also add ".old" to image sequence outputs if folder already exists
This commit is contained in:
@@ -441,7 +441,7 @@ namespace Flowframes.IO
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add ".old" suffix to existing files to avoid them being overwritten. If one already exists, it will be ".old.old" etc.
|
||||
/// Add ".old" suffix to an existing file to avoid it getting overwritten. If one already exists, it will be ".old.old" etc.
|
||||
/// </summary>
|
||||
public static void RenameExistingFile(string path)
|
||||
{
|
||||
@@ -464,6 +464,29 @@ namespace Flowframes.IO
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add ".old" suffix to an existing folder to avoid it getting overwritten. If one already exists, it will be ".old.old" etc.
|
||||
/// </summary>
|
||||
public static void RenameExistingFolder(string path)
|
||||
{
|
||||
if (!Directory.Exists(path))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
string renamedPath = path;
|
||||
|
||||
while (Directory.Exists(renamedPath))
|
||||
renamedPath += ".old";
|
||||
|
||||
Directory.Move(path, renamedPath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Log($"RenameExistingFolder: Failed to rename '{path}': {e.Message}", true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Easily rename a file without needing to specify the full move path
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user