Elixir, like many other languages, interprets backspaces inside strings as escapes. Some of them have special meanings (like \n
for a newline), but the ones that don't become the escaped character itself. So for example, \U
becomes U
. You can check this by writing IO.puts <your string>
in iex
, and you'll see that your backslashes disappear:
iex(1)> IO.puts "C:\Users\Mostafiz\OneDrive\Desktop\New_Text_Document"
C:UsersMostafizOneDriveDesktopNew_Text_Document
To get the path you want you need to either escape the backspash itself (writing \\
in your string) or use forward slashes, since they are also recognized as path separators.
So either this:
iex(1)> IO.puts "C:\\Users\\Mostafiz\\OneDrive\\Desktop\\New_Text_Document"
C:\Users\Mostafiz\OneDrive\Desktop\New_Text_Document
Or this:
iex(1)> IO.puts "C:/Users/Mostafiz/OneDrive/Desktop/New_Text_Document"
C:/Users/Mostafiz/OneDrive/Desktop/New_Text_Document