I have this code:
Code:
# Define variables
current_date=$(date "+%m%d%Y")
windows_folder="/dir/home/dir/reports/dir/dir/$current_date"
# Make folder
mkdir -p "$windows_folder"
#Copy all .DAT files to current dated folder in MDM folder
cp *.DAT /dir/home/dir/reports/dir/dir/$current_date
# Append current date to all files, move files to Windows shared folder
for file1 in *[a-z].xlsx
do
mv "$file1" "$windows_folder/${file1%.*}${current_date}.xlsx"
done
That sends all files with an extension '.xlsx' to a folder dated with today's date. Example, in folder '01292017' are several files like this: TODAY_REPORT01292017. I like the way the folder is named with the current date (01292017), but I would like the files to be as such 'TODAY_REPORT_01292017'. How is this possible?