Reputation: 651
export SQLFILENAME=$1
scp -prv scratch/patchtestnew/db_new_temp/*/$SQLFILENAME /scratch/patchtestnew/db_new/*/
Want to copy from one location to another but don't know the intermediate directories and hence placed * but it doesn't catch the location
There is only one directory inside db_new and db_new_temp
Upvotes: 0
Views: 39
Reputation: 34205
This solution will work, provided that you can guarantee there's only one directory in db_new
and no files. Also you should quote both the $1
and $SQLFILENAME
in case they contain uncommon characters. (and you don't need scp
if you're copying on the same host)
Otherwise, it's supposed to "just work". If it doesn't, try listing both locations with ls
- that should give you an idea about what's going wrong.
If you can't guarantee that there's never going to be another file/directory under db_new
, I'd recommend finding another way to solve the problem though. You can not only get silent failures, but also silent data loss this way.
Upvotes: 1