I have a directory that contains the backup of many computers using NTFS file system.
/backup/REP1/database
/backup/REP2/database
I now want to scp from the backup file server to the database server, both are running Ubuntu 14.
Inside the backup directories are Visual FoxPro files that are not all the same case, but are the same name. There are other files in the backup directory that I do not want to scp.
/backup/REP1/database/usersupport.DBF
/backup/REP1/database/System.dbf
/backup/REP2/database/UserSupport.dbf
/backup/REP2/database/system.dbf
In my bash script I am using 2 loops to create the remote path and file names.
computer_list=(REP1 REP2 REP3 REP4 REP5 REP6 REP7 REP8 REP9 REP10 REP11 REP12 REP13 REP14 REP15 REP16)
file_list=(usersupport.cdx usersupport.dbf usersupport.fpt system.dbf)
for computer_name in ${computer_list[@]}; do
## delete working dir
delete_working_dir
for file_name in ${file_list[@]}; do
remote_file=${remote_path}${computer_name}/${dow}/CustomerData/system/${file_name}
local_file=${working_directory}${file_name}
#echo $remote_file
echo $local_file
# scp -i $ID $USER@$HOST:$remote_file $local_file > /dev/null 2>&1
scp -i $ID $USER@$HOST:$remote_file $local_file
# change databse file permissions
chmod 0777 ${local_file}
done
# process mysql
process_mysql
## delete working dir
delete_working_dir
done
The command scp will not copy the source file if the case is not the same.
What would be the correct or easiest way to get the source file regardless of case.
I did try shopt -s nocasematch
, but no go.
Can I use substitution on the remote file name?
[:lower]
This user uses this
scp -B -p ${Auser}@${aSrcHOST}:${aSrcDIR}/*.[Oo][Kk] $aTgtDIR
So I believe the substitution might work. I am not sure of the syntax.
usersupport.DBF
;UserSupport.dbf
...