How do I create a new file in a different directory? If the file exists it should also create a new file.
I am using the command:
Touch workdirectory/filename.txt
This question is related to
unix
The command is lowercase: touch filename
.
Keep in mind that touch
will only create a new file if it does not exist! Here's some docs for good measure: http://unixhelp.ed.ac.uk/CGI/man-cgi?touch
If you always want an empty file, one way to do so would be to use:
echo "" > filename
Source: Stackoverflow.com