Skip to content

Instantly share code, notes, and snippets.

@ChrisPenner
Created April 5, 2020 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisPenner/4a4b2b13a8ebaeb3cf0e8ce9c3619976 to your computer and use it in GitHub Desktop.
Save ChrisPenner/4a4b2b13a8ebaeb3cf0e8ce9c3619976 to your computer and use it in GitHub Desktop.
Copy/Pasta
#!/bin/bash
# Use at your own risk :P
FOLDER="/tmp/copy-pasta"
if [ $# -lt 1 ]; then
cat << EOF
usage: copy <files>
EOF
exit 1
fi
if [ -d $FOLDER ]; then
rm -rf ${FOLDER:?}/*
else
mkdir $FOLDER
fi
cp -r "$@" $FOLDER
#!/bin/bash
# Use at your own risk :P
FOLDER="/tmp/copy-pasta"
if [ $# -gt 1 ]; then
cat << EOF
usage: pasta <destination dir>
EOF
exit 1
elif [ $# == 0 ]; then
DEST="."
else
DEST="$1"
fi
if [ ! -d $FOLDER ]; then
cat << EOF
Remember to copy before you pasta!
EOF
exit 1
fi
cp -r "$FOLDER"/* "$DEST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment