Getting a file size from detached revit file

hello everyone!

I’m wondering if there is a way where I can get the file size for a detached revit project? There are certain inevitable times where I have to detach from the main project file and run this dynamo script. The value of File Size nodes are all 0. I understand why this is happening - detached copy isnt ‘saved’ thats why these nodes can’t read the file size.

Any tips or advice would be greatly appreciated. thanks guys!

Is there any reason why you can’t save the file first and check for file size later? In case you don’t want the detached file, you can save it to a temporary location or delete it later. Seems like a straightforward solution.

thanks for the solution, I’m using batch processor which is a software that automatically batch runs multiple revit files. it won’t save the file in the process - unless I include a code on dynamo but that seems too complicated.

I assume all documents are already opened in a Revit session? Or is it, like your example, just one project?


so I’m using batch processor where the software will intake a list of revit files’ locations.
It will open each revit file, run the dynamo script automatically, close the revit file and move on to the next one on the list.

before I hit ‘start’ from the batch processor software, i have an option to choose if i want to run this in detach mode. There have been some complication with the software and revit files opening locally thats why I’m trying to run it in detached mode but no file size.

All Revit projects have been opened by someone else in the past since they are actively used projects.

Ok, if your batch processor closes the Revit file, you only need to save it in a temp folder, for example and delete it later. So here goes the saving function:


# Enable Python support and load DesignScript library
import clr
# Import DocumentManager
import RevitServices
from RevitServices.Persistence import DocumentManager

# The inputs to this node will be stored as a list in the IN variables.
pathSave = IN[0]

# Place your code below this line
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

IsSaved = False
# Save active document
	IsSaved = True

# Return
OUT = IsSaved

To make sure the file is saved before attempt to get file size, use Passthrough from Clockwork and connect anything you want to perform first in passThrough:

1 Like

Thank you for the help!

However, is it okay to have ‘False’ value?


Yes, it is ok to have the return value as false, this means that the file has already been saved. I added the try except section just in case you want to check the file has been saved already or you are running the script a second time.

1 Like

thanks for the advice!! I tried multiple ways but it seems like the file is not saving and not working. I’m sure it has to do with what I’m doing - since im amateur yet.

there is no parameter or information from Revit that tells the file size right…?
if there is, i could easily just use parameter nodes to bring that information up but i dont think thats possible…

Show us the script you are using and where and what the warnings are, it is impossible to knwo where your script is failing.

Nop, the file size is handle by Windows, so no property in Revit to retrieve it.


Do you know which Clockwork version I can find that Passthrough? The only pass through I see is ,


which seems bit different from yours.


Using clockwork 2.3.0, but any version beyond 2 will have that node.