# Possibly unclear manual regarding Base.touch

**URL:** <https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388>\
**Category:** General Usage\
**Created:** [June 29, 2024, 1:13pm UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388 "2024-06-29T13:13:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![George\_Morrison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george_morrison/32/208189_2.png) [@George\_Morrison](https://discourse.julialang.org/u/George_Morrison)\
**Post date:** [June 29, 2024, 1:13pm UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388/1 "2024-06-29T13:13:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 29, 2024, 3:19pm UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388/2 "2024-06-29T15:19:45Z")

</div>

Could you point to where you found this?

---

<div class="post-metadata">

**Author:** ![George\_Morrison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george_morrison/32/208189_2.png) [@George\_Morrison](https://discourse.julialang.org/u/George_Morrison)\
**Post date:** [June 29, 2024, 8:12pm UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388/3 "2024-06-29T20:12:16Z")

</div>

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](https://stackoverflow.com/questions/70205170/what-is-the-equivalent-of-touch-on-windows-cmd).

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [June 30, 2024, 9:05am UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388/4 "2024-06-30T09:05:51Z")

</div>

Generally speaking Julia does not use or emulate PowerShell on Windows but uses [libuv](https://libuv.org/) 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.

---

<div class="post-metadata">

**Author:** ![George\_Morrison](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/george_morrison/32/208189_2.png) [@George\_Morrison](https://discourse.julialang.org/u/George_Morrison)\
**Post date:** [June 30, 2024, 10:31am UTC](https://discourse.julialang.org/t/possibly-unclear-manual-regarding-base-touch/116388/5 "2024-06-30T10:31:02Z")

</div>

Thank you for the reply and the informative answer.

Sorry I should not asked about something I could not test.
