How to Save mail attachment with "/" in the name " correctly "

Hey everyone,

I have a process where I get mail from users and save the attachment to a predefined folder with the name they gave in the body of the mail.

I do this by save attachemnt then move file to that folder with the name user gave in the body. (this is how I rename)

How can I save this is attachment correctly If the name of the file contains " / " .
For example:
Name of file given is 123/22222, when I move file the robot takes β€œ/” as a document seperator, so it looks for 123 folder to save the file as 222222. How can I workaround this problem any one faced the same issue?

Thank you for your helps.


If you check normally creating a file with β€œ/” in windows it will throw you warning message as below

So it’s better to replace β€œ/” to another valid character like β€œ_”

Hope this helps you


1 Like

ahhh, I see , so it is actually not possible to do it.

Hi @berkaykor

U can use String.replace("/","_") and then u can try to move file