Need help to copy contents of a file

Hi,

I am stuck up with a problem of copying the contents of a directory where one of the folder name is changed daily.

Problem:

I have the folder structure as:

RefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_build_xxx/.../..

In the above path the build number (xxx) will be changed daily and I need to copy the files from one of the sub-folder from here.

I hope the the question is clear.

expecting this...

$ cp -p `ls -1d RefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_buildRefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_build_* | tail -1`/.../.. <destination_path>

Try this,

ls -d RefWorlds2/LINGCC4_X64/odsdev/odessy/UTI/621GA_build_xxx*/.../.. | tail -1 | sed 's/.*/cp \-r & \/tmp/g' | sh

Hi Siva,
It seems to work fine. I will let you know If I face with any issue.

thanks a lot

cheers Karni