123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- function ts() {
- return $(date)
- }
- usage () {
- echo "Usage: $0 -s - source, -d destination, -n note";
- exit 1;
- }
- while getopts s:d:n: flag
- do
- case "${flag}" in
- s) src=${OPTARG};;
- d) dst=${OPTARG};;
- n) note=${OPTARG};;
- ?) usage;;
- esac
- done
- if [ -z ${src} ]; then
- read -p "Source [$(pwd)]: " src
- if [ -z ${src} ]; then
- src="$(pwd)"
- fi
- fi
- if [ -z ${dst} ]; then
- read -p "Destination [$(pwd)]: " dst
- if [ -z ${dst} ]; then
- dst="$(pwd)"
- fi
- fi
- if [ -z ${note} ]; then
- read -p "Note of session/event: " note
- if [ -z ${note} ]; then
- note=""
- else
-
- note=" - ${note}"
- fi
- fi
- if [ ${src} = ${dst} ]; then
- echo "Source and destination are the same, exiting..."
- exit 2
- fi
- echo "Source: [${src}]"
- echo "Destination: [${dst}]"
- echo "Note: [${note}]"
- read -p "Confirm (Y): " confirm
- if [ ${confirm} = "Y" ]; then
- echo "Reading source and beginning to move..."
-
- if ! [ -d {src}]; then
- echo "Source directory does not exist, exiting..."
- exit 2
- fi
-
- if [ -d {dst}]; then
- mkdir -p -m 700 ${dst}
- fi
- find ${dst} -
-
-
-
- dst_subdir="${dst}/${file_creation_date}${note}"
-
- file_new_name="$(read creation date and time, format)-${file}"
-
-
-
-
-
-
-
-
- else
-
- echo "Operation is not confirmed."
- exit 1
- fi
|