Simple Copy?

I need to copy a file from one directory into another - but it has to be the 'most recent' directory - a new diretory gets created each week. Copy a file from one directory into another is easy enough - how do I find/specify the most recent directory?

The directories are named by Julian Date... so the most recently created directory would have the latest date as a name.

You could probably run a find command to get the latest sub-directory within a directory structure, but I'd use :-

ls -tr|tail -1

thanks - that returns the directory that I'm looking for. How does that get incorporated into a copy command? ie: is there a way to simply write it as cp /dir/file /dir/?? (where ?? is the result of ls -tr|tail -1)

if you're using Korn shell or bash you can use:-

cp /dir/file /dir/$(ls -tr|tail -1)

cheers.