This doesn't look like it is just a string conversion to me.
If you think this is just a string conversion, please specify exactly what the steps are in a conversion from a string starting with a backslash character to a string starting with a forward slash character AND specify exactly what the steps are in a conversion from a string start gin with a forward slash character to a string starting with a backslash character. Note, of course, that the only data that any of the steps in either set of steps can reference are the output from a df command and the input string.
If you can't write down all of the steps needed to do that, we have to assume that we can't do what you've asked us to do for you.
After you write down all of the steps involved in both conversions, try writing code to do perform those steps and show us what you've done.
If that's the one and only share that will ever be fed into this, then yes, it is. If it's not, it really becomes quite complicated and requires lots more information from you.
Answer our questions faster and you'll get replies faster.