Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty folder left after removing torrent (delete data) #35

Closed
gboudreau opened this issue Sep 16, 2020 · 4 comments
Closed

Empty folder left after removing torrent (delete data) #35

gboudreau opened this issue Sep 16, 2020 · 4 comments

Comments

@gboudreau
Copy link

Type: Bug Report

Your Environment

  • Version used:
    • Commit ID (development release) ee0257a557a7bedf4110dcbb50bda2207494b81d

Summary

When removing (and deleting data) a torrent that has 1+ file(s) inside a folder, the folder is left empty. It should be deleted.

Possible Solution

When deleting data, Flood should check if the torrent contains files inside a folder, and if so, check if that folder is empty, after deleting all files, and if so, it should deleted the folder too.

Steps to Reproduce

  1. Download a torrent that includes 1+ files inside a folder
  2. Remove that torrent
  3. Check the checkbox to Delete data
  4. Check that the file(s) were deleted, but an empty folder is left
@gboudreau
Copy link
Author

I think it should already try to delete the folder (recursively):

if (fs.lstatSync(file).isDirectory()) {
fs.rmdirSync(file, {recursive: true});

Maybe filesToDelete doesn't contain the folder, but only files inside it..?
I guess one would have to check what is returned by d.directory_base and fileListMethodCallConfig.methodCalls, to understand how a torrent with a file differs from a torrent with a file inside a folder.

@jesec
Copy link
Owner

jesec commented Sep 16, 2020

See #13 and #25.

@gboudreau
Copy link
Author

Thanks for the pointers. Didn't see those somehow...
I'll still try my hand at implementing a fix; probably something along the lines of tracking when a new base_dir gets created by Flood (or rTorrent?) for an added/moved torrent, and deleting an empty directory only if that flag is set.
Might not be solid enough to be merged as-is, but should be good enough for my use-case.

@gboudreau
Copy link
Author

In fact, since any fix I would implement would very probably end up being for me only, I'll skip the dev environment setup & learn Node parts, and just implement what I need in a shell script.
Let's close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants