Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cp /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
- cp: cannot create regular file `/my/other/path/here/cpedthing.txt': No such file or directory
- COMMAND1 && COMMAND2
- mkdir -p /my/other/path/here/ && touch /my/other/path/here/cpedthing.txt
- FILE=./base/data/sounds/effects/camera_click.ogg
- mkdir -p "$(dirname "$FILE")" && touch "$FILE"
- mktouch() {
- if [ $# -lt 1 ]; then
- echo "Missing argument";
- return 1;
- fi
- for f in "$@"; do
- mkdir -p -- "$(dirname -- "$f")"
- touch -- "$f"
- done
- }
- mktouch ./base/data/sounds/effects/camera_click.ogg ./some/other/file
- #!/bin/sh
- for f in "$@"; do mkdir -p "$(dirname "$f")"; done
- touch "$@"
- mkdir -p /my/other/path/here/
- touch /my/other/path/here/cpedthing.txt
- install -D /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
- install -D <(echo 1) /my/other/path/here/cpedthing.txt
- if [ ! -d /my/other ]
- then
- mkdir /my/other/path/here
- cp /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
- fi
- mkdir -p /my/other/path/here;cp /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
- mkdir -p /my/other/path/here
- cp /my/long/path/here/thing.txt /my/other/path/here/cpedthing.txt
- cd /my/long
- cp --parents path/here/thing.txt /my/other
- ptouch() {
- for p in "$@"; do
- _dir="$(dirname -- "$p")"
- [ -d "$_dir" ] || mkdir -p -- "$_dir"
- touch -- "$p"
- done
- }
- mkdir -p /code/tmp/other/path/here
- touch /code/tmp/other/path/here/cpredthing.txt
- mkdir -p /code/tmp/other/path/here &&
- touch $_/{cpredthing.txt,anotherfile,somescript.sh}
- mkdir -p /code/tmp/other/path/here
- touch /code/tmp/other/path/here/cpredthing.txt /code/tmp/other/path/here/anotherfile /code/tmp/other/path/here/somescript.sh
- rm -rf /abs/path/to/file; #prevent cases when old file was a folder
- mkdir -p /abs/path/to/file; #make it fist as a dir
- rm -rf /abs/path/to/file; #remove the leaf of the dir preserving parents
- touch /abs/path/to/file; #create the actual file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement