Rename Files

Hi all,

I’m trying to rename pdf files after I plotted them.
I’m using Konrad’s custom node to do so.

It looks really simple to use but somehow I’m screwing up.

It gives me the error that it cannot create a file when that file already exists. What on earth is it creating? I just want to rename the file.

Many thanks again!

Daan

test naam veranderen.dyn (7.6 KB)

Are you ensuring that the Identifiers match the file name you are attempting to rename exactly?

1 Like

Do you mean the number of files? Yes those should be the same since they are coming from the same view set.

i meant the file name itself in this instance. Can you expand the all-nodes feeding the Rename.Files node, so we can see exactly what is being fed?

The node says the numbers of the lists should be matching, but the name of the Identifier has to be exactly the same as the the name in the directory path is that what you mean?

Yes, that is what worked for me.
Can you test this with your file naming?

I finally got it to work!

What did the trick was to copy the python script in the work space.
That way the Identifiers and the file names can still be different. That way I can filter on the sheet numbers from the list.

Thanks for your help Ewan_Opie.!

4 Likes

Can you please share the script , thanks in advance.

I couldn’t get this to work… for some reason it’s renaming the file with only the first character of the new name. Would anyone be able to help explaining why?
Many thanks

try making your inputs lists :slight_smile:

No… it still won’t do it :frowning:
The same error occurs. the error says:

Traceback (most recent call last):
File “”, line 27, in
WindowsError: [Errno 2] [Errno 3] Could not find a part of the path ‘E:\test\aaa.txt’.

did you make both inputs lists ?
it worked for me when I did that…

image

Yes, I did. I’m starting to think it’s me :confused:

@adam_bear1 once I did like you - directly with the python script instead of using the custom node it worked fine.
Thanks!

1 Like

I think that’s because the original node is specifying the data type for a default value, making it not a list, when it needs to be a list

2 Likes

Hello , Pls guide me, how to copy the python script in the workspace from node (rename.file), as my rename files node is not working, and I am unable to understand how to copy the python script as mentioned in the solution…(Beginner in Dynamo)
Thanks in advance.

You select in the search bar by typing ’ python script ’ and then double click on the light grey area. Then copy / paste the script.

Old topic, but I was struggling with the same problem found by @Vasco_Pereira and I found a solution.
Just delete the default values in the custom node input, make a new custom node and it will do the job correctly.
RenameFiles - solved 1

@Konrad_K_Sobon , maybe you wanna check for debug

2 Likes