Archi-Lab - Rename Files

Hi Everyone,

I am having problems with the “Rename Files” Node from the Archi-Lab Package. My project is in Revit 2019.

The issues seem very similar to what Julia had within this post. The files seem to be renamed to the first character of the string rename and then error out. (sometimes it will rename the second file in the list but with the second string character in the file name.)

I have worked through the comments within this above post to no avail. To my surprise, replacing the node from the one posted here actually worked the best so far. As it successfully renamed the first file correctly, but did does not proceed to rename the other files. (Frozen Python Script Node in image)

Here is an image of my script below :

Error message within Watch Node is :

Traceback (most recent call last) :
File “,string.”, line 27, in
Windows Error: [Errno 2] [Errno 3] Could not find part of the path ‘C:\Users[MY NAME]\OneDrive - [COMPANY NAME]\Documents\MY NAME Documents\PDF Creator Files\MOR-FHS-MOR-ZZ-ZZ-M3-I-0001(v19) - Sheet - 0001 - Ground Floor Overall View.pdf’.

Traceback (most recent call last) :
File “,string.”, line 27, in
Windows Error: [Errno 17] [Errno 183] Cannot create a file when that file already exists.

[this just repeats for each remaining index]

Would the fact I am on a OneDrive Directory affect it? As whenever a file is created/renamed it needs to sync it back to the server?

Many thanks all,

Shatner

EDIT : I tried running the script into a external harddrive that won’t sync so don’t think it is the onedrive issue.

Hi @Shatner ,

Through OOTB Nodes you could first copy your files into the same folder with a new name. Then with a Transaction.End and a Passthrough node delete the original files.

Hi Daan,

Thanks for the speedy response. So I need to add nodes that would copy each of the PDFs, giving them the desired name and then have the script remove the original files?

Yes, exactly.
And to be sure the copying happens first and is completely finished use a setup like this:

1 Like

HI Daan,

Thanks for the above. I am trying to rebuild the script but I am struggling with getting the files into File.System.CopyFile node as FileSystem.GetDirectoryContent seems to be supplying a string value instead of a variable as it states it should be doing…

image
image

However that string file path is enough for the FileSystem.DeleteFile. So good thing i had a copy of the pdfs in a different folder.

How do i get the contents of the directory as files?

Shatner

Ah i got it, I was missing the File From Path node. That works thank you Daan.