Filter list of filepaths / file names

Hi Everyone,
I’m working on a file upgrader which uses nodes from the Rhythm package, and everything seems to work OK so far, but after I iterate through all the subdirectories to create a list of all my files, how can I filter out everything except .rfa .rvt and .rte files?
We’ve got quite a few files of other formats scattered around our library such as .txt, .xls and .png files, the Document.BackgroundOpen node obviously hangs when it gets to a filetype which is not native to Revit.

Thanks!

Hi Conrad, you can use the Directory.Contents node, it comes with a search string:

1 Like

Einar’s answer should cover all of your needs. But if you also need to search all nested folders recursively, you should try the below node from Clockwork:

2 Likes

Thanks very much Einar & Dimitar - the recursive directory search and sting filter are way more elegant than what I had, which was about 10 levels of directory contents nodes to discover all the files, and then I was trying to filter them after compiling the list.

This was size of the original;

And the new;

Much nicer, thanks for your help!

4 Likes

One more question; now that I have a working dynamo file, is there away to send someone my .dyn file so they can run it on their machines (with revit/dynamo installed), but without them having to install the clockwork and rhythm packages separately?
i.e. is there a way to “compile” just those custom nodes into my file?

I want to share this with a couple of other Revit users who don’t use dynamo, so the simpler I can make it for them to use, the better.

[quote=“rad1cal, post:5, topic:11890”]
is there away to send someone my .dyn file so they can run it on their machines (with revit/dynamo installed), but without them having to install the clockwork and rhythm packages separately?
[/quote]Compilation or pack-and-go would be nice. If the DYFs are in the same folder as your DYN and you transmit the whole folder, it should work on another’s machine. You’d have to test it, though (DLLs?).

Nice. I was thinking old-fashioned BAT, then read the file “dir.txt”

dir /s /b > dir.txt

maybe with this first

DEL /S *.00??.r??

I do this go to pres windows key + r:
image

…\AppData\Roaming\Dynamo

Then copy the packages inside the page’s folders to the other users. I made a .exe of those files fore easy handeling. If you find a better solution pleas share :wink:

Myself I run in some problems white this upgrade way if there are central models, works seds, errors involved where the script needs to go trough.

Short answer: no. But if the node is simply a python block you can copy that directly into your graph and essentially “remove” the custom nodes. You can also do this with custom nodes made of other nodes, but this can sometimes cause issues with lists, lacing, or other nested nodes.

1 Like

Best practice would be to include a list of package names and versions used, in a note in the graph.