SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Remove folders after deleting duplicates

soooo, based on my previous question I can tell you SK is not deleting the complete folder if other files than the music files are present in there.

I tested this with a music folder that contained the files (identified as dupes) and moved them to another folder instead of deleting them.

once the music files are moved, my initial folder contains : cover.jpg and a metadata folder created beforehand.

Is there a way to tell SK to completely delete the folder, even if there are remaining files, once its music files were removed ?

In worste case, I could create a script deleting folders if it do not find any flac files inside it, but I’d rather have a checkbox in SK allowing me to do this.

Okay, because you are only moving them rather than deleting them there is the chance that you may decide to put them back, so the logic is to not delete the folders. If you had actually deleted them then folders would be deleted if empty or if only contain the following files:

  • Thumbs.db
  • desktop.ini
  • cddbinfo.txt
  • AMGReport.log

or image file types

  • .jpg
  • .bmp
  • .gif
  • .jpeg
  • .pdf
  • .png

Maybe that disitinction is wrong, but that is the current logic ?

OK so this wont work as I do have an extra folder inside my album folders, containing json files (metadata).

Is it possible to tell SK, somehow, to also delete the content of this folder so it will be able to remove the full folder ? the metadata folder always has the same name.

But for now, I guess my best bet is to simply let SK make his job, and use a script that will delete all forlders that has no music files.

It would not be safe for me to simply delete a users subfolders regardless of what they contain by default, seems like may need an extra option that the user could select ?

100% agreed.

Indeed, that should be a user pick, based on his/her folder structure.

Okay moved this discussion to its own topic and raised an issue https://jthink.atlassian.net/browse/SONGKONG-2335

Cool, As I am not getting enough of Jira tickets in my actual job, I’ll jump on the one you created as well :wink:

Thanks for the support !

Have been implementing a solution, would like some initial feeback before release

Added checkbox When find duplicates delete folder if empty or only contains the following files, so if enabled when deleting (or moving) duplicates it will check the folder containing the deleted song and do the folowing.

  • Check folder and subfolders for any remaining audio files, if any found dont delete folder.
  • Otherwise, traverse the folder and subfolders and for each sub folder delete any files that match the entries in the list (* is a wildcard)
  • If subfolder now empty delete it.
  • If parent folder now empty delete it

This is indeed a very good start, but I would recommend to allow the end user to add his/her own files/folders to your list.

As an example, almost every album folder I do have contains a subfolder, that contains json files.

So if I was running the above, 99% of my “empty” folders would remain in place.

so, lets say a user has this kind of structure

/Album_Name/Extra_user_folder/files

then it would be great to have an “add” button that would allow the user to specify that if the album folder contains a subfolder named “Extra_user_folder”, we can totally delete it.

Hi, you can add to the list, its not actually a list but an editable text file, just with one entry per line. I was going to have as a list but think just alot easier to be able to type in directly.

So if your folder has a subfolder names Extra_user_folder, and within that there is a file called info,json, you could add info,json to the list, that file would be deleted and if Extra_user_folder was now empty that subfolder would be deleted.

What you cannot currently do is add Extra_user_folder to the list and have SongKong delete that folder regardless of its contents. It would be technically possible to do this but it sounds rather dangerous, better to specify actual files that can be removed and then remove folders that become empty as a result of this.

1 Like

If there is a way to add files types to be monitored for deletion. Then it’s great ! :wink:

One extra thing, I think it might be good to allow the user to run this task appart from the duplicates finder.

this to allow him/her to have to fix folder that were emptied of their music files in a previous run?

Okay that is a good idea, would also be useful for tidying up after Fix Songs ectera. Add a new task called Empty Folder Deleter, but adding a new top level task is quite alot of work so one for the future - https://jthink.atlassian.net/browse/SONGKONG-2363

Now released in SongKong 8.6 Post released 15th November 2022

1 Like

I’ll run a test on the god old Arovane folder I’ve backed-up and will let you know how it ends.

Hopefully, the new “most tracks” setting will avoid the issue I was running into -> a few tracks in one folder, a few others in the other. I’ll keep you posted :wink:

thanks again Paul !

1 Like

I am missing the “Album with most tracks” and “Erliest folder creation date” settings @paultaylor.

I believe this was not correctly added to the docker image.

Hi, sorry seems to be some issue with Linux based versions looking into it now

1 Like

Working on new build now, see https://jthink.atlassian.net/browse/SONGKONG-2364 that should replace existing 8.6 within the hour, then later will release SongKong 8.6.1 for those who have already installed SongKong 8.6 so they get notification of fix version without needing to check this forum.

@meaning okay new docker image available for Intel nas, I just tested it on synology nas and it worked for me. You can check you have new version by selecting About and you’ll see Build Date will say 17/11/2022 (yes I know its one day out)

This is in :

This also:

Seems GOOD !

OK I ran a few tests.

here are my settings :

*.cue
*.log
*.txt
*.nfo
*.m3u
*.sfv
*.html
*.htm
*.rar
*.json
*.jpg
*.jpeg
*.png
*.gif
*.bmp
*.pdf
*.ini
*.db

Here is one of the folders that should have been deleted:

as you can see both *.jpg, *.nfo and *.pdf are part of my list. But the folder remained there.

I also run into another issue. As I am using rclone to copy files (fuse FS) I have a ton of .fuse_hiddenXXXXXX hidden files in my folders. I cannot get rid of these folders as the *.fuse_hidden* mask is not working. IT even avoids other masks to get taken in consideration.

I also have some “empty” files that are just named without any extension, that were previously used to announce the genre and size of a music release :

I wonder how I could get rid of these. I’ve tried *]-[*, but it did not work.

I send you the support files now.