Skip to content

Instantly share code, notes, and snippets.

@radiovisual
Last active August 29, 2015 13:56
Show Gist options
  • Save radiovisual/9000716 to your computer and use it in GitHub Desktop.
Save radiovisual/9000716 to your computer and use it in GitHub Desktop.
Copy all files from location
#!/bin/bash
# Edit these to point to the proper source
# and destination locations
SOURCE_LOCATION="<SOURCE LOCATION HERE>"
DEST="<DESTINATION LOCATION HERE>"
echo -e "\033[93m------------------------------------"
echo -e "\033[93mCopy files from source location v1.0"
echo -e "\033[93m------------------------------------"
echo -e "\033[36mCurrent Source: \033[39m$SOURCE_LOCATION"
echo -e "\033[36mCurrent Destination: \033[39m$DEST"
echo
# Create the destination directory if it doesnt exist
if [ ! -d "$DEST" ]; then
echo -e "\033[35mDestination directory does not exist."
echo -e "\033[39mDirectory \033[36m$DEST \033[39mwas created for you."
echo
mkdir -p $DEST
fi
OPTIONS="COPYALL QUIT"
select opt in $OPTIONS; do
if [ $opt = "COPYALL" ]; then
echo -e "\033[93mCOPYING ALL FILES FROM: \033[39m$SOURCE_LOCATION"
for file in "$SOURCE_LOCATION/"*
do
cp -Rpfv "$file" "$DEST/"
done
exit
elif [ $opt = "QUIT" ]; then
exit
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment