How to delete files only if a key file is missing

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Specifically, I'm discussing deleting leftover files after a rar unarchive. The .rar, .r00, .r01, etc. files are all deleted when the file is unarchived. But what about leftover files such as .par files, .rev files, etc. that might be left. I could set a rule to delete them, but I do not want to delete them until after the file has been unarchived... and the best way I have thought of is to only delete leftover files if the .rar file is missing since that indicates that it has been unarchived.

I have it set to only unarchive after all parts of the archive have not changed for 5 minutes. Now I'm just trying to come up with a good clean up rule.

Thanks
Aquenon
 
Posts: 9
Joined: Mon Mar 19, 2018 1:00 pm

Had to look up par and rev files as I'm not familiar with them. Will need to consider adding support for removing those automatically as well when unarchived.

For now, you can try something like:
Code: Select all
    If (all) are met
        If (all) are met for (all files in the same folder)
            Name does not match (name)
            Extension not is rar

That will match if no rar file with the same name exists in the same folder. You might need to play with it but that's the basic gist.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

That was the piece I was missing.

I did keep trying different things after making this post. I just knew it had to be something with nested conditions, but I got needlessly complicated for a while. I did end up coming up with part of the solution a few hours later, but adding on the name condition was a piece I hadn't considered. Thank you!
Aquenon
 
Posts: 9
Joined: Mon Mar 19, 2018 1:00 pm


Return to Support