Skip to main content

There's a very simple method using touch command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it.

Done!


And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy ^^

Alternative code to handle files

The above code requires a folder to be selected to work, and does nothing if a file is selected. Changing the shell script code to the code snippet below will handle files as well, and create an empty file next to the selected file:

for df in "$@"; do if [[ -d "$df" ]]; then d="$df" elif [[ -e "$df" ]]; then d="$(dirname "$df")" fi touch "$d"/empty.txt done 

There's a very simple method using touch command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it.

Done!


And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy ^^

There's a very simple method using touch command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it.

Done!


And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy ^^

Alternative code to handle files

The above code requires a folder to be selected to work, and does nothing if a file is selected. Changing the shell script code to the code snippet below will handle files as well, and create an empty file next to the selected file:

for df in "$@"; do if [[ -d "$df" ]]; then d="$df" elif [[ -e "$df" ]]; then d="$(dirname "$df")" fi touch "$d"/empty.txt done 
added 27 characters in body
Source Link

There's a very simple method using 'touch'touch command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it. Done!

Done!


And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy :)^^

There's a very simple method using 'touch' command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it. Done!

And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy :)

There's a very simple method using touch command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it.

Done!


And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy ^^

Source Link

There's a very simple method using 'touch' command in Automator:

Create a new service in Automator

Create a Service in Automator

Set it to receive selected "files or folders" in Finder

enter image description here

Add a Run Shell Script with Pass input "as arguments" and paste this code into the shell:

for d in "$@"; do cd "$d" touch untitled.txt done 

paste code

Save it. Done!

And if you want to add a keyboard shortcut to it, go to System Preferences > Keyboard

add shortcut

Enjoy :)