7.4: never sort files that are still downloading

Files ending in .part, .crdownload or .download (any case), and a file next
to its own unfinished download (Firefox's empty placeholder), are skipped
before any pattern check, folder zipping or unzipping.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
sarahandClaude Opus 5.5 committed 2026-10-09 10:52:18 +02:00
1 parent 234889ba6d
commit 4a52120b1a
5 files changed
+27 -9

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
Title = "SaraSortd Config"
Version = "7.3"
Version = "7.4"
SafeMode = 1
SilentMode = 0
SortTimer = 1
+1 -1
View File
@@ -1,5 +1,5 @@
Title = "Unset"
Version = "7.3"
Version = "7.4"
ParentDir = "Unset"
SortDirs = 0
+1 -1
View File
@@ -1,5 +1,5 @@
Title = "Unset"
Version = "7.3"
Version = "7.4"
LastFile = "Unset"
ParentDir = "Unset"
ValidInputDirs = ["*"]
+5 -4
View File
@@ -1,6 +1,6 @@
<img align="center" src="https://git.srhtnin.garden/sarah/RepoAssets/raw/branch/main/SaraSortd/Banners/SaraSortd.png" width="100%" alt="SaraSortd: a file and directory sorting daemon built with python."/>
(Version = "7.3")
(Version = "7.4")
It's made by Sarah, hence the name. :3
@@ -58,7 +58,7 @@ Here's a step-by-step tutorial (in case you don't want to watch the video).
```
Title = "SaraSortd Config" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.3" # Just the version number for the config file.
Version = "7.4" # Just the version number for the config file.
SafeMode = 1 # If SaraSortd should stop if an error with the config appears. 1 is stop, 0 is continue.
@@ -67,6 +67,7 @@ SilentMode = 0 # If SaraSortd should write things it does, to the terminal.
SortTimer = 3 # How many seconds it takes for SaraSortd to check input directories for new files to sort.
DotFiles = 0 # If SaraSortd should sort files that begin with ".". This is mainly for linux users, since hidden files always have "." in front of them.
# Files that are still downloading are never sorted or even checked (since 7.4): anything ending in .part (Firefox), .crdownload (Chrome and other Chromium browsers) or .download (Safari), and a file next to its own unfinished download (like the empty "video.mp4" Firefox makes beside "video.mp4.part"). They're sorted as usual once the download finishes.
Logging = 1 # If SaraSortd's logging system should be active. If this is 0, nothing will be logged into files.
@@ -169,7 +170,7 @@ The output directory config references the SaraSortd config (GlobalConf.toml). T
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.3" # The version number of the config.
Version = "7.4" # The version number of the config.
LastFile = "Unset" # The last file that was sorted to this directory. It gets automatically updated whenever a file gets sorted to this directory.
@@ -225,7 +226,7 @@ Overwrite = 1 # Whether this specific file type can be overwritten by others of
```
Title = "Unset" # NOTE: Do not change the title. This is so that the program knows which config file is which.
Version = "7.3"
Version = "7.4"
ParentDir = "Unset" # The name of this directory. It gets automatically updated when this config gets copied to an output directory.
+19 -2
View File
@@ -6,7 +6,7 @@ import shutil
import time
import toml
# Version = "7.3"
# Version = "7.4"
ConfPath = "./GlobalConf.toml"
@@ -393,6 +393,20 @@ def FileInputValid(File, FilePath, ParentName):
return False
# Files that are still downloading (since 7.4): Firefox's .part, Chromium's .crdownload and Safari's .download.
# SaraSortd never touches them, not even to check them against patterns.
PartialDownloadSuffixes = (".part", ".crdownload", ".download")
def IsPartialDownload(FilePath):
if os.path.basename(FilePath).lower().endswith(PartialDownloadSuffixes):
return True
# A file next to its own unfinished download, E.G. the empty "video.mp4" Firefox makes beside
# "video.mp4.part" and fills in at the end. Moving it would break the download.
return any(os.path.exists(FilePath + Suffix) for Suffix in PartialDownloadSuffixes)
def IsCatchAll(Pattern):
# A pattern made of only "*" takes any file.
return Pattern != "" and set(Pattern) == {"*"}
@@ -632,7 +646,7 @@ def Main():
if len(GetConf("Unzip", OutDirConfPath) or []) >= 1:
ZipTypes = GetConf("Unzip", OutDirConfPath)
for OutputFile in os.listdir(OutputPath):
if OutputFile.startswith("."):
if OutputFile.startswith(".") or IsPartialDownload(f"{OutputPath}/{OutputFile}"):
continue
for ZipType in ZipTypes:
@@ -662,6 +676,9 @@ def Main():
for FileName in os.listdir(InputPath):
FilePath = f"{InputPath}/{FileName}"
if IsPartialDownload(FilePath):
continue
if os.path.isdir(FilePath) and InputDirConf.get("SortDirs", 0) == 0:
continue