mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
Delete files that are not in torrent #3115
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#3115
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @rsn8887 on GitHub (Sep 22, 2015).
My feature request is for qbittorrent to include an option to automatically delete all files from the torrent dir that are not in the torrent!
This would help tremendously when updating torrents where only a few files changed, but some might also have been deleted/renamed.
The force check option takes care of finding all the files that are new or different, but it doesn't delete files that are in the dir but not in the torrent that is being downloaded.
No torrent client I know of supports this, but it would truly allow one to do a rudimentary sync of a dir with a given torrent.
@ghost commented on GitHub (Sep 27, 2015):
This could be dangerous if a torrent was saved to the documents folder and then the user accidentally deletes all their files.
@rsn8887 commented on GitHub (Sep 27, 2015):
Yes but just move to recycle bin instead, and then a simple requester "xxx number of files will be moved to trash from yyy folder name. Are you sure you want to do this?"
The requester could even pop up twice saying: "Are you absolutely sure?"
I think that should be enough. I think the benefits of being able to "syncupdate" a torrent folder by far outweigh the risks.
@rsn8887 commented on GitHub (Sep 27, 2015):
Alternatively, the files could not be deleted, but simply moved into a subfolder with a unique name such as "torrent_name_obsolete_files_processID" or something like that
@Gliktch commented on GitHub (Oct 22, 2015):
Recycle bin has limits. On many computers it may be 30GB or even less. There are plenty of people with more than 30GB in their Documents, Desktop or Videos folders, your suggestion would still cause unacceptable loss of data in some cases.
Another suggestion would be to right-click a torrent in the list and choose 'Open Folder' (or double-click if you have yours configured to do that on double-click), delete the files yourself, close the folder then delete torrent from the list. Only takes a few seconds but the full responsibility is then on you to select the unwanted files/folder yourself and carry out the delete operation.
@tp0 commented on GitHub (Oct 25, 2015):
I definitely do not support this idea, for the reasons already mentioned. Caters to a rare usecase but in minimum disturbs much more common usecase and at worst deletes users' files. Should never be the default. Maybe as an option but I'll leave that to the devs.
Not only it could delete users' docs and other files, but also other torrents if there are e.g. several single-file torrents in a same folder.
@alfrix commented on GitHub (Nov 2, 2015):
No, very bad idea. if the problem is that you have a download a subtitle or something like #3964, then i suggest Remove Empty Directories (aka RED) and add .srt or whatever to the ignore list.
@alfrix commented on GitHub (Nov 2, 2015):
@sledgehammer999 this a duplicate of #1606
and very well explained in
https://qbforums.shiki.hu/index.php/topic,3738.0.html
@sledgehammer999 commented on GitHub (Nov 2, 2015):
Even if it isn't a dupe, this is a bad idea anyway.
@chr0m commented on GitHub (May 4, 2018):
It's a shame that this didn't take of. I download torrents with lots of small files. When a new version comes out I can join the torrent and get the changes but any files removed from the torrent will remain on my drive. I'm not saying delete them automatically, but it would be nice to have a feature to do this manually. Or even just be able to identify files on the hdd in the download location of the torrent that aren't actually in the torrent.
@fl4shb1c commented on GitHub (Jul 27, 2018):
I was searching for a solution to this myself - but there's a workaround.
Right click on the torrent and select "Set location...". You will be prompted to select a new location for the data of that torrent. Choose a new location (ideally on the same drive so all data doesn't have to be physically re-written) - only the data required for that torrent will be moved. You can then go back to the original folder and delete whatever is left. After you've done this, use "Set location..." again to put the data back to the original folder.
...at least If I understood the OP's requirement correctly(?)
@rsn8887 commented on GitHub (Jul 27, 2018):
This sounds like a great solution. I also found a third party program called torrentclean.exe or similar. It deletes all the unneeded files. Works great too.
@chr0m commented on GitHub (Jul 27, 2018):
I've actually been using the "Set location" trick for a few weeks now, it works great :)
@FranciscoPombal commented on GitHub (Jul 27, 2018):
This is certainly not a dupe of #1606.
@thalieht consider re-opening this. A workaround exists, mentioned by @fl4shb1c some comments above, but it is cumbersome. It would be quite useful to have this feature natively.
Also, possibly label this one as 'workaround-exists' or similar?
@thalieht commented on GitHub (Jul 27, 2018):
sledgehammer thinks it's a bad idea so... i can imagine how it could be useful to delete the extra stuff when deleting the whole torrent but i don't get why you put stuff in the torrent folder and then to want to delete ONLY that stuff? https://github.com/qbittorrent/qBittorrent/issues/3842#issuecomment-386621954 sounds like an edge case.
@FranciscoPombal commented on GitHub (Jul 27, 2018):
@thalieht @sledgehammer999
Yeah it's a bit of an edge case, but at least common enough that someone bothered to come up with torrentclean.exe
I could see it happening with torrents that have a lot of archives and the user then extracts the files to the same folders as the archives, for example.
@fl4shb1c commented on GitHub (Jul 27, 2018):
I can explain why I would use it...
I have data sets shared as torrents that can be 100s of GBs containing thousands of files. Someone centrally updates the files and generates an updated torrent. Rather than having to re-downloaded all the data over and over again, I load the new torrent and "Force recheck". This brings the updated files and new data without having to download everything all over again... the downside however is that anything which is no longer part of the updated torrent is left behind taking space (and potentially corrupting future data/analysis).
Ideally it should be an option presented when the user runs a "Force recheck" ...an extra warning/option which asks the user if they also want to remove files no longer part of the updated torrent - with all the warnings of risk to loss of data in the same folder etc. I do understand there is a big risk, so files could potentially be moved to a temporary folder to be reviewed upon completion with a final warning stating that these files will be deleted. Or alternatively, popup a dialogue box showing a list of files that will be removed, asking the user again for confirmation.
Or to be more efficient (but longer to code), there could be a new option to "update torrent". The user can then select an updated torrent and qBT can compare the old/new and knows which files from the original torrent are no longer required, removing the risk of accidental data loss.
Maybe it could be presented as a feature request and see how many votes it gets to prioritise accordingly? Or maybe there aren't enough of us with that requirement?
@FranciscoPombal commented on GitHub (Jul 27, 2018):
@fl4shb1c
Good example of a use case for this feature!
@aevans0001 commented on GitHub (Jan 26, 2019):
I also would use this feature! Please add
@nickreserved commented on GitHub (Sep 2, 2019):
https://sourceforge.net/projects/torrent-directory-comparison/
@fragtion commented on GitHub (Nov 11, 2020):
Yes, It's a bad idea if it's default operation.. However it's also incredibly useful for people who know what it does and how to use it. How about an advanced option to enable, with a warning or similar?... There are several users who would like this functionality, this demand can't be ignored.
The "Set location" trick is a great workaround but it would still be nice to "cleanup junk files" inplace, without needing to move the folder
@tecno14 commented on GitHub (Sep 10, 2021):
is there any tool that make this feature for now ?
@nickreserved commented on GitHub (Sep 10, 2021):
https://sourceforge.net/projects/torrent-directory-comparison/
@chr0m commented on GitHub (Dec 22, 2021):
If I want to delete files not in the torrent I simply use the "Set Location" feature to move it to a new location. It moves everything in the torrent and leaves the rest behind
@vytautasBrundza commented on GitHub (Dec 27, 2021):
I would love such feature too!
My case why I was searching for it was an early access application that has tons of files (30+Gb). It gets updated every month or two. I redownload updated torrent to the same folder. Most of the time it works, but sometimes there are old files that are messing it up. So I have to delete everything and download fresh.
I will definitely try the set location feature, but a function to clean the folder would make my life much easier.
@chr0m commented on GitHub (Dec 27, 2021):
The set location works a treat, I use it all the time
@nickreserved commented on GitHub (Dec 27, 2021):
I write it previously, and even if it is TOTALLY UNRELATED to qBittorrent (very sorry for that), I write it again because it can help people.
To do torrent - directory comparison, please use my tool Torrent-Directory Comparison.
https://sourceforge.net/projects/torrent-directory-comparison/
Install Java and run:
java.exe -jar torrent.jar my_DOS_games.torrent C:\directory_where_my_DOS_games_stored - > output.txt
Last "-" means "display files in directory not exist in torrent".
Then add in front of any line in newly created file "output.txt" the "del " command.
Rename file "output.txt" to "output.bat" and run it.
PS: Sorry -again- for advertisation of my own tool (it is open-source) but I see many people need it.
@nickreserved commented on GitHub (May 13, 2022):
Sorry. This is not a place to support my little program.
But if you read the error message, it says that you must install the newer java runtime environment JRE.
@sorvani commented on GitHub (Oct 17, 2022):
I wish this feature existed also. I have been dealing with it by using the move location process, but moving 100+ GB, just to put it back is highly annoying.
@ICEknigh7 commented on GitHub (Feb 28, 2024):
This would be a blessing for regularly updated torrents with thousands of files which occasionally change some of the file names.
Maybe don't enable it by default if it's "dangerous" and "a bad idea", but truth is it would be super useful when used properly.
@BenCheung0422 commented on GitHub (Jan 1, 2025):
For people in the future finding this thread, I have made a CLI program without need of Java, written in Rust, available at:
https://github.com/AnvilloyDevStudio/torrent-cleaner/releases
I think this would be quite clear.
@xavier2k6 commented on GitHub (May 23, 2025):
ANNOUNCEMENT!
For anybody coming across this "Feature Request" & would like/love to see a potential implementation in the future!
Here are some options available to you:
Please select/click the 👍 &/or ❤
reactionsin the original/opening post of this ticket.Please feel free (If you have the "skillset") to create a "Pull Request" implementing what's being requested in this ticket.
(new/existing contributors/developers are always welcome)
DO:
DO NOT:
(These will be disregarded/hidden as "spam/abuse/off-topic" etc. as they don't provide anything constructive.)