Script to create a file in a non-existing folder
Copy this script in a mtouch file and add the execution bit:
#!/bin/sh
[ ! -z $1 ] && (mkdir -p `dirname $1`; touch $1)
Then run it as follow:
/patch/to/mtouch /some/folder/which/does/not/exist/for/the/file/F
This will create the folder /some/folder/which/does/not/exist/for/the/file and then touch the file F in this folder.
Written by padawin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Script
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#