Empty folders left behind on Recording drive (1 Viewer)

gibman

Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Usa
    Home Country
    Ethiopia Ethiopia
    ofcourse :)
    Ill just run a "format e:\" drive.

    looking at the code we delete all files with the same name as the recording itself.
    eg. myrecording.ts

    it will then try and delete :
    myrecording.jpg (thumb)
    myrecording.xml (meta data)

    it then queries folder containing the ts file.
    does it anymore contain files ?
    does it anymore contain subfolders ?

    if no, then it tries do delete the folder.

    So the code should handle it.

    We could have a situation where we are unable to delete one or more of the files (due to file locks etc).
    The delete-folder process then fails and never retries again. The user has to manually seek out those folders and delete them themselves.

    how to handle this ?

    1) Create a monitoring thread "recording cleanup" which has some public array/list where the failedrecording method is able to notify the thread, simply by inserting a recording object into this array. the monitor thread picks this up, and retries the process each 1 min. or so.. once properly deleted it will remove the recording from the array and cease any further actions.

    cons: if you restart tvservice, it will be upon start of the service unaware of these failed-2-delete folders.

    2) On tvservice start a method call will take care of the orphaned folders and delete those.

    3) 1+2 (as combination.)

    Using some SQL table to store this information seems overkill to me.

    /gibman


    Just please be careful, it is much better to have few left over folders than some non-empty folders getting removed (we have had that at some point in the past :)).
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    1) Create a monitoring thread "recording cleanup" which has some public array/list where the failedrecording method is able to notify the thread, simply by inserting a recording object into this array. the monitor thread picks this up, and retries the process each 1 min. or so.. once properly deleted it will remove the recording from the array and cease any further actions.

    cons: if you restart tvservice, it will be upon start of the service unaware of these failed-2-delete folders.

    2) On tvservice start a method call will take care of the orphaned folders and delete those.

    3) 1+2 (as combination.)

    Using some SQL table to store this information seems overkill to me.

    The less we can have "constant" file system polling in the tv service the better it is. So I would suggest:

    1) create DB table with failed folders after a cleanup
    2) on tv service startup try to remove those folders - this could be done also once after waking up from S4/S3

    it is not something that needs to be done on real time since it will just cause extra HD accessing - user itself can cause folders to get locked by using some 3rd party tools and it could create easialy 50 folders that needs to be checked and by polling those folders it is possibility to cause some short period stuttering.
     

    thefieryshadow

    New Member
    March 3, 2010
    3
    0
    I came across this thread because I am having the same problem with empty folders being left after older episodes are deleted. I was playing around with a script that uses the "rmdir" command and it was coming back as if the folder wasn't actually empty, and I realized that there was still a "Thumbs.db" hidden system file in the folder which I believe may be causing the folder to not get deleted. Hopefully this is helpful information.
     

    Users who are viewing this thread

    Top Bottom