mirror of
https://git.srhtnin.garden/sarah/SaraSortd.git
synced 2026-10-13 18:38:11 +02:00
Added a FileLimit parameter to DirConfig to limit the amount of files in
an output directory.
This commit is contained in:
1 parent
05c5a7b1c1
commit
c73f3493c5
2 files changed
+16
-1
No files matched your search
@@ -2,6 +2,7 @@ Title = "Unset"
|
||||
LastFile = "Unset"
|
||||
ParentDir = "Unset"
|
||||
ValidInputDirs = ["*"]
|
||||
FileLimit = 0
|
||||
|
||||
[[Files]]
|
||||
Pattern = "*"
|
||||
|
||||
+15
-1
@@ -251,7 +251,6 @@ def DecideNewPath(FilePath):
|
||||
DirConfPath = f"{Output}/{DirConfName}.toml"
|
||||
|
||||
ValidInputDirs = GetConf("ValidInputDirs", DirConfPath)
|
||||
print(ValidInputDirs)
|
||||
|
||||
for ValidInputDir in ValidInputDirs:
|
||||
ValidInputDir = Parse(String = ValidInputDir, Parent = GetConf("ParentDir", DirConfPath))
|
||||
@@ -267,6 +266,21 @@ def DecideNewPath(FilePath):
|
||||
if not os.path.exists(DirConfPath) or not InputDirValid:
|
||||
continue
|
||||
|
||||
|
||||
OutputFiles = 0
|
||||
|
||||
FileLimitConf = GetConf("FileLimit", DirConfPath)
|
||||
|
||||
if FileLimitConf > 0:
|
||||
for OutputFile in os.listdir(Output):
|
||||
if OutputFile.startswith("."):
|
||||
continue
|
||||
if os.path.isfile(os.path.join(Output, OutputFile)):
|
||||
OutputFiles += 1
|
||||
|
||||
if OutputFiles >= FileLimitConf:
|
||||
continue
|
||||
|
||||
FileConf = GetConf("Files", DirConfPath)
|
||||
|
||||
if not FileConf:
|
||||
|
||||
Reference in new issue
Block a user