I'm trying to automate copying the content from a variable path (my camera) into a partially-user-defined path (desktop+date+event). The problem is that mkdir and cp complain saying that the directory cannot be created, but I don't understand why despite having DuckDuckGo'd for over an hour. What am I doing wrong?
echo -n "Enter event name and press [ENTER]: "
read event
sleep 0
day=`date +%Y-%m-%d`
month=`date +%Y-%m`
media="/media/F009-64A5"
source="${media}/PRIVATE/AVCHD/BDMV/STREAM/*"
target="/home/kv/Desktop/$month/$day"\_"$event"
mkdir $target
cp -pr $source $target
mkdir -p $target
will create the path with all necessary subpaths.