Sorry I was not sure where this should go. I was trying to follow a tutorial and it suggested the following command:
touch(“10_Streams_Networking\sample_file.txt”)
changed
touch(joinpath(“10_Streams_Networking”, “sample_file.txt”) )
On Linux the only OS I can test this creates a long file name. Based on my search it appears that PowerShell Equivalent to the Linux command touch, New-item also creates folders. So I am assuming that on a windows machine this creates a folder and a file but I have noway to test this but I thought I should mention it. Now I need to get back get back to learning Julia.
Could you point to where you found this?
As I said I have noway to test this and should not have said anything. Sorry I bothered anyone with this.
The code in question is in a paid tutorial here is the line:
touch("10_Streams_Networking\\sample_file.txt")
The info on the touch equivalent I found at bash - What is the equivalent of "touch" on windows cmd? - Stack Overflow.
Generally speaking Julia does not use or emulate PowerShell on Windows but uses libuv for many file system operations to get cross-platform functionality.
On Windows, touch("10_Streams_Networking\\sample_file.txt")
and touch("10_Streams_Networking/sample_file.txt")
are equivalent and creates the file if the directory exists but the file doesn’t. It gives an error if the directory doesn’t exist.
On Linux the forward slash version works in the same way. The backslash case is different since backslash is not a directory separator on Linux but is considered as a filename character among others.
Probably the tutorial assumes that the directory already exists. It could also have used a forward slash in the example for better platform independence, but it might confuse Windows users, who are not always aware that the forward slash works the same as the backslash in paths.
Thank you for the reply and the informative answer.
Sorry I should not asked about something I could not test.