# Replace random text from Revit sheet name

**URL:** <https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196>\
**Category:** Uncategorized\
**Created:** [June 1, 2017, 1:15pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196 "2017-06-01T13:15:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![DeanB72](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DeanB72](https://forum.dynamobim.com/u/DeanB72)\
**Post date:** [June 1, 2017, 1:15pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196/1 "2017-06-01T13:15:45Z")

</div>

HI… Can someone point me in the right direction of the node/nodes I should use to remove random text placed at the end of a filename as follows…

eg…files named  
"223\_45\_GROUND FLOOR PLAN" to be renamed "223\_45"  
“789\_67\_1st FLOOR PLAN” to be renamed “789\_67”

The original filenames are generated by Revit using the sheet number and sheet name which both need to remain in the model but I need the sheet name removing from the pdf but the end text/sheet name differs every time.

I should add that I know how to get the sheet name values using the Sheet.Sheetname node but then not sure what to do to take that list and use it to rename files minus each sheet name via plugging into the String.Replace node. It’s the bit inbetween I can’t figure out.

Thanks

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [June 1, 2017, 1:51pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196/2 "2017-06-01T13:51:00Z")

</div>

To answer your first question: Assuming your sheet numbers are all 6 characters long, you can get those first 6 characters with the Substring node.  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/5/85d1549a00760f04c27e04a1e7920949e66305a5.png)

As for your second question, you have a few options: You can use the Rename Files node from Archi-lab to rename files within a directory. Or you can try using the OOTB nodes to make your own workaround - something like… Copy original PDFs to a new (or same) location with the new name then delete the original PDFs.  
 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/8/7/873b8d5104aca51b71ddd99309a360db59a3bc45.png)

See if that gets you started.

---

<div class="post-metadata">

**Author:** ![DeanB72](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@DeanB72](https://forum.dynamobim.com/u/DeanB72)\
**Post date:** [June 1, 2017, 1:53pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196/3 "2017-06-01T13:53:41Z")

</div>

Thanks Nick, I think your first comment is the answer I’m looking for.

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [June 1, 2017, 9:46pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196/4 "2017-06-01T21:46:20Z")

</div>

I recommend using **String.Split** and a **List.GetItemAtIndex** instead.

 ![](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cd7f9d1ae1bbc77d4df5ab0bfb68c1123e053869.PNG)

I’m wrapping up my efforts on a set with sheet numbers between 2 and 8 characters (A0, A200, T1 A220, T1 A220.1, T1 FP306), but they all have " - " between sheet number and sheet name thanks to Bluebeam and/or Revit depending on firm producing the sheet.

---

<div class="post-metadata">

**Author:** ![annikruell](https://avatars.discourse-cdn.com/v4/letter/a/ea5d25/32.png) [@annikruell](https://forum.dynamobim.com/u/annikruell)\
**Post date:** [October 7, 2019, 2:32pm UTC](https://forum.dynamobim.com/t/replace-random-text-from-revit-sheet-name/12196/5 "2019-10-07T14:32:54Z")

</div>

Hi, Try this but I can’t combine in a list

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/1/714810c2f884f243f0e7b2f58c05827cdd45acc8.png)
