Help with renaming multiple pdf files - First Dynamo graph

Hi… I tried the graph which did create the .cmd file but when I run it, I get an error saying… “the syntax of the command is incorrect”

Can you send the text in the rename.cmd…it should create a command like this…

rename “c:\yourpdffile.pdf” “new.pdf”

If its not like that review your graph maybe you missed something, see if the " " are written…the error is due to incorrect command syntax and normally this is due to missing quotes " ". it should work coz i tested it and use this code.

Also do not forget to delete your rename.cmd everytime you finished using it. Just to tidy up your files just incase you run it later by accident.

The text does seem to be like that. Not easy to be sure because when I run it, the error flashes up for a split second and tgen disappears so i have to repeatedly run it to try see the text of the error. I’m wondering if it could be related to the version of dynamo I’m using as I had to download an educational version on my home laptop to try it. Maybe it will work fine on my office computer because I did check my graph quite thoroughly and also downloaded yours. I’ll try on my office workstation and take it from there.

Thanks for your help

4bimfercesp… This is the error message I’m getting…

your nearly there…you just have "\ on your command it should just be quotes "…

post your graph and I will check.

Thanks… That’s what I was thinking but not sure where I get rid of it without causing another error.

I’m guessing it’s the code block containing the "rename "; that’s inserting it ? But if I change that I seem to get the code block turning red.

Found the problem node…

It was the C:\TEST that needed an extra \ on the end in order for it to be replaced. As a test I have input the directory path as a string and that works but I’m not sure if that’s the best workaround ?

Thanks

try this…graph

rename_files.dyn (11.0 KB)

I added a code block to remove the …

I have just tried the following adaptation which seems to work…

I’m guessing my solution acts very similar to yours but mine is a more uneducated version ?

not at all…what ever works for you…mine is just lesser nodes…

This is actually good for you as you have fixed your own query by using what you think you know.

Sometimes or most of the times fixing it yourself makes things more interesting and you will learn more.

well done…

Thanks for your help and patience 4bimfercesp