Deleting Backup Families in Sub Folders

Hi all,

I’m using an adapted version of the Rhythm.BackupRFADeleter to delete backup families and have the option to include sub-folders. The only difference i have made to the node is to use Directory.ContentsAll instead of the Directory.Contents.

I have saved it as a custom node, however, when run it does not delete any backup families but if i take the content out of the custom node and place it in the script, using the same inputs, it finds the backup families and deletes them. Any idea why this might be?

Thanks,

Do you have an error message?

Unfortunately no, there was no error message which is why im not sure as to why it wont work in the custom node

hi @ppittas

if you want to use other method, you can use this script:family_backup_deleter.dyn (3.7 KB)

python code:

import sys
sys.path.append(r"C:\Program Files (x86)\IronPython 2.7\Lib")

import os
import re


filelist = list()
for root, dirs, files in os.walk(IN[0]):
	for file in files:
		matches = re.match(".*\.[0-9]+\.(rfa|RFA)$", file)
	
		if matches:
			backup = os.path.join(root, file)
			filelist.append(backup)
			os.remove(backup)

OUT = filelist

usage:
A

-biboy

Thanks @blsalvio
this code works perfectly

hi @ppittas

Actually, I already made an application for this. Dynamo is not needed. If you want, I can share the .exe file to you.

-biboy

that wont be needed but thank you, easier to deploy this to others using Dyno

Hi @ppittas maybe you can also use one .bat file or excel vba file to remove all backup files (.rfa and/or .rvt) from your library easily.
Cheers