When you want to copy a file which is generated every day and has a date inserted inside its name, you can use the following bash file:
#!/bin/bash
dt=`date +%Y%m%d`
#dt=`date +%Y%m%d%H%M%S`
from_dir=”/home/adrian/1″
to_dir=”/home/adrian/2″
from_file=”$from_dir/myfile”_”$dt”.csv
to_file=”$to_dir/myfinalfile.csv”;
#echo “cp $from_file $to_file”
cp $from_file $to_file
#!/bin/bash dt=`date +%Y%m%d` #dt=`date +%Y%m%d%H%M%S` from_dir=”/home/adrian/1″ to_dir=”/home/adrian/2″ from_file=”$from_dir/myfile”_”$dt”.csv to_file=”$to_dir/myfinalfile.csv”; #echo “cp $from_file $to_file” cp $from_file $to_file