I've go a number of directories named like:/data/db/OX/8_10/data/db/OX/9_1/data/db/OX/9_2And need to copy some files (all the pt.* files) from the second latest one (above 9_1) to the latest one (above 9_2).I have tried directly like this. cp -p /data/db/OX/9_1/pt.*  /data/db/OX/9_2However, Instead of typing /data/db/OX/9_1/   & /data/db/OX/9_2. I'd like to be able to write:cp -p /data/db/OS/$prior_version/pt.* /data/db/OS/$latest_version/And derive $prior_version and $latest_version from the list of directories in /data/db/OX/ in a shell script.
How to copy datasets from prior version directory to latest version directory
shell script;filenames