Delete files that are not in torrent #3115

Open
opened 2026-02-21 16:35:28 -05:00 by deekerman · 31 comments
Owner

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.

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.
Author
Owner

@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.

@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.
Author
Owner

@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): 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.
Author
Owner

@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

@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
Author
Owner

@Gliktch commented on GitHub (Oct 22, 2015):

Yes but just move to recycle bin instead

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.

@Gliktch commented on GitHub (Oct 22, 2015): > Yes but just move to recycle bin instead 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.
Author
Owner

@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.

@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.
Author
Owner

@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): 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)](http://www.jonasjohn.de/red.htm) and add .srt or whatever to the ignore list.
Author
Owner

@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

@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
Author
Owner

@sledgehammer999 commented on GitHub (Nov 2, 2015):

Even if it isn't a dupe, this is a bad idea anyway.

@sledgehammer999 commented on GitHub (Nov 2, 2015): Even if it isn't a dupe, this is a bad idea anyway.
Author
Owner

@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.

@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.
Author
Owner

@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(?)

@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(?)
Author
Owner

@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.

@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.
Author
Owner

@chr0m commented on GitHub (Jul 27, 2018):

I've actually been using the "Set location" trick for a few weeks now, it works great :)

@chr0m commented on GitHub (Jul 27, 2018): I've actually been using the "Set location" trick for a few weeks now, it works great :)
Author
Owner

@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?

@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?
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@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?

@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?
Author
Owner

@FranciscoPombal commented on GitHub (Jul 27, 2018):

@fl4shb1c
Good example of a use case for this feature!

@FranciscoPombal commented on GitHub (Jul 27, 2018): @fl4shb1c Good example of a use case for this feature!
Author
Owner

@aevans0001 commented on GitHub (Jan 26, 2019):

I also would use this feature! Please add

@aevans0001 commented on GitHub (Jan 26, 2019): I also would use this feature! Please add
Author
Owner

@nickreserved commented on GitHub (Sep 2, 2019):

https://sourceforge.net/projects/torrent-directory-comparison/

@nickreserved commented on GitHub (Sep 2, 2019): https://sourceforge.net/projects/torrent-directory-comparison/
Author
Owner

@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

@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
Author
Owner

@tecno14 commented on GitHub (Sep 10, 2021):

is there any tool that make this feature for now ?

@tecno14 commented on GitHub (Sep 10, 2021): is there any tool that make this feature for now ?
Author
Owner

@nickreserved commented on GitHub (Sep 10, 2021):

is there any tool that make this feature for now ?

https://sourceforge.net/projects/torrent-directory-comparison/

@nickreserved commented on GitHub (Sep 10, 2021): > is there any tool that make this feature for now ? https://sourceforge.net/projects/torrent-directory-comparison/
Author
Owner

@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

@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
Author
Owner

@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.

@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.
Author
Owner

@chr0m commented on GitHub (Dec 27, 2021):

The set location works a treat, I use it all the time

@chr0m commented on GitHub (Dec 27, 2021): The set location works a treat, I use it all the time
Author
Owner

@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 (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.
Author
Owner

@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.

@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.
Author
Owner

@sorvani commented on GitHub (Oct 17, 2022):

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.

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.

@sorvani commented on GitHub (Oct 17, 2022): > 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. 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.
Author
Owner

@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.

@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.
Author
Owner

@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.

@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.
Author
Owner

@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:

  1. Please select/click the 👍 &/orreactions in the original/opening post of this ticket.

  2. 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:

  • Provide constructive feedback.
  • Display how other projects implemented same/similar etc.

DO NOT:

  • Add a "Bump", "me too", "2nd/3rd" etc. or "criticizing" comment(s).
    (These will be disregarded/hidden as "spam/abuse/off-topic" etc. as they don't provide anything constructive.)
@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:** 1. Please select/click the 👍 **&/or** ❤ `reactions` in the original/opening post of this ticket. 2. 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:** * Provide constructive feedback. * Display how other projects implemented same/similar etc. **DO NOT:** * Add a "Bump", "me too", "2nd/3rd" etc. or "criticizing" comment(s). **(These will be disregarded/hidden as "spam/abuse/off-topic" etc. as they don't provide anything constructive.)**
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/qBittorrent#3115
No description provided.