# Rename Files

**URL:** <https://forum.dynamobim.com/t/rename-files/18077>\
**Category:** Uncategorized\
**Created:** [January 11, 2018, 5:29pm UTC](https://forum.dynamobim.com/t/rename-files/18077 "2018-01-11T17:29:47Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![d.jansenMM3LJ](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@d.jansenMM3LJ](https://forum.dynamobim.com/u/d.jansenMM3LJ)\
**Post date:** [January 11, 2018, 5:29pm UTC](https://forum.dynamobim.com/t/rename-files/18077/1 "2018-01-11T17:29:47Z")

</div>

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

 ![rename files](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/d/7dfbf44593d0622e7c1037b5bd02c1ed28d0f1df.png)[test naam veranderen.dyn](https://forum.dynamobim.com/uploads/short-url/ziuV9XEio1LdmLgliShbGg9YLPR.dyn) (7.6 KB)

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [January 15, 2018, 1:19am UTC](https://forum.dynamobim.com/t/rename-files/18077/2 "2018-01-15T01:19:32Z")

</div>

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

 ![ezgif-3-1ade6f997a](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/c/ac4ddeb9ad2bf012c217de5d333b177fefd58f9b.gif)

---

<div class="post-metadata">

**Author:** ![d.jansenMM3LJ](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@d.jansenMM3LJ](https://forum.dynamobim.com/u/d.jansenMM3LJ)\
**Post date:** [January 15, 2018, 8:54am UTC](https://forum.dynamobim.com/t/rename-files/18077/3 "2018-01-15T08:54:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [January 15, 2018, 8:13pm UTC](https://forum.dynamobim.com/t/rename-files/18077/4 "2018-01-15T20:13:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![d.jansenMM3LJ](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@d.jansenMM3LJ](https://forum.dynamobim.com/u/d.jansenMM3LJ)\
**Post date:** [January 16, 2018, 7:57am UTC](https://forum.dynamobim.com/t/rename-files/18077/5 "2018-01-16T07:57:12Z")

</div>

![rename files](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/5/a54b5a01b1e002d8b11fd62f73c78df24308ca11.png)

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?

---

<div class="post-metadata">

**Author:** ![Ewan\_Opie](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/ewan_opie/32/77070_2.png) [@Ewan\_Opie](https://forum.dynamobim.com/u/Ewan_Opie)\
**Post date:** [January 16, 2018, 8:36pm UTC](https://forum.dynamobim.com/t/rename-files/18077/6 "2018-01-16T20:36:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![d.jansenMM3LJ](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@d.jansenMM3LJ](https://forum.dynamobim.com/u/d.jansenMM3LJ)\
**Post date:** [January 17, 2018, 10:36am UTC](https://forum.dynamobim.com/t/rename-files/18077/7 "2018-01-17T10:36:33Z")

</div>

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.!

 ![rename files](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/b/ab1aa42ab62fcd4a0b6a2ab47836dbdd2fab4455.png)

---

<div class="post-metadata">

**Author:** ![dilipgowda21n](https://avatars.discourse-cdn.com/v4/letter/d/58956e/32.png) [@dilipgowda21n](https://forum.dynamobim.com/u/dilipgowda21n)\
**Post date:** [September 10, 2018, 11:20am UTC](https://forum.dynamobim.com/t/rename-files/18077/8 "2018-09-10T11:20:03Z")

</div>

Can you please share the script , thanks in advance.

---

<div class="post-metadata">

**Author:** ![Vasco\_Pereira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vasco_pereira/32/38735_2.png) [@Vasco\_Pereira](https://forum.dynamobim.com/u/Vasco_Pereira)\
**Post date:** [September 18, 2018, 3:08pm UTC](https://forum.dynamobim.com/t/rename-files/18077/9 "2018-09-18T15:08:46Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/4/041bcdd211e379d9a32507fa199e6076479c8185.png)

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [September 18, 2018, 3:42pm UTC](https://forum.dynamobim.com/t/rename-files/18077/10 "2018-09-18T15:42:52Z")

</div>

try making your inputs lists 🙂

---

<div class="post-metadata">

**Author:** ![Vasco\_Pereira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vasco_pereira/32/38735_2.png) [@Vasco\_Pereira](https://forum.dynamobim.com/u/Vasco_Pereira)\
**Post date:** [September 18, 2018, 3:49pm UTC](https://forum.dynamobim.com/t/rename-files/18077/11 "2018-09-18T15:49:55Z")

</div>

No… it still won’t do it ☹  
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’.

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [September 18, 2018, 3:51pm UTC](https://forum.dynamobim.com/t/rename-files/18077/12 "2018-09-18T15:51:27Z")

</div>

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

![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/3/83ecda7b8b72f78fde054645d4f552892b490bcc.png)

---

<div class="post-metadata">

**Author:** ![Vasco\_Pereira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vasco_pereira/32/38735_2.png) [@Vasco\_Pereira](https://forum.dynamobim.com/u/Vasco_Pereira)\
**Post date:** [September 18, 2018, 3:58pm UTC](https://forum.dynamobim.com/t/rename-files/18077/13 "2018-09-18T15:58:29Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/6/8631fddcf704a4b491f303054d511aec7e5e8079.png)

---

<div class="post-metadata">

**Author:** ![Vasco\_Pereira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/vasco_pereira/32/38735_2.png) [@Vasco\_Pereira](https://forum.dynamobim.com/u/Vasco_Pereira)\
**Post date:** [September 18, 2018, 4:10pm UTC](https://forum.dynamobim.com/t/rename-files/18077/14 "2018-09-18T16:10:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adam\_bear1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/adam_bear1/32/13411_2.png) [@adam\_bear1](https://forum.dynamobim.com/u/adam_bear1)\
**Post date:** [September 18, 2018, 4:13pm UTC](https://forum.dynamobim.com/t/rename-files/18077/15 "2018-09-18T16:13:47Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/b/db7b0a06aea6f5f0f713fefe5d904a5e9bb08c3e.jpeg)

---

<div class="post-metadata">

**Author:** ![ajirevit](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@ajirevit](https://forum.dynamobim.com/u/ajirevit)\
**Post date:** [January 5, 2021, 8:28pm UTC](https://forum.dynamobim.com/t/rename-files/18077/16 "2021-01-05T20:28:10Z")

</div>

> [@d.jansenMM3LJ](#):
>
> to copy the python script in the work space

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.

---

<div class="post-metadata">

**Author:** ![d.jansenMM3LJ](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@d.jansenMM3LJ](https://forum.dynamobim.com/u/d.jansenMM3LJ)\
**Post date:** [January 6, 2021, 8:23am UTC](https://forum.dynamobim.com/t/rename-files/18077/17 "2021-01-06T08:23:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rubenbosetti](https://avatars.discourse-cdn.com/v4/letter/r/8dc957/32.png) [@rubenbosetti](https://forum.dynamobim.com/u/rubenbosetti)\
**Post date:** [February 3, 2021, 1:47pm UTC](https://forum.dynamobim.com/t/rename-files/18077/18 "2021-02-03T13:47:37Z")

</div>

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](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/a/ca07b9e6e4297c0e82684544bf7749370cd8510a.png)

 ![RenameFiles - solved 2](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/0/e/0e1659e881bb7faabb7b4645651d0dad054ec058.png)

@Konrad_K_Sobon , maybe you wanna check for debug
