Page 1 of 1

Finding latest file versions

Posted: Fri Feb 26, 2010 4:28 am
by muralisankarr
Hi,

The source files are pushed into landing directories in undefined times. On any time we may get a new version of a file.
I had a requirement to select the file from the latest version sub-directory. And different files will be in different versions. For example

-SrcDir
-------SDA1
------------Sub-SDA1
----------------------V0.1
----------------------File X
----------------------V0.2
----------------------File X
------------Sub-SDA2
----------------------V0.1
----------------------File Y
-------SDA2
------------Sub-SDA1
----------------------V0.1
----------------------File Z
----------------------V0.2
----------------------File Z
----------------------V0.3
----------------------File Z

I want to select all the files from the latest version from above structure like

SDA1>Sub-SDA1>V0.2>FileX
SDA1>SUB-SDA2>V0.1>FileY
DSA2>Sub-SDA1>V0.3>FileZ

Please sugget me some ways to achieve this?

Many Thanks for the time and suggestions
MSR

Posted: Fri Feb 26, 2010 5:30 am
by ray.wurlod
Use a combination of ls -lrt and tail commands to get the latest entry from each directory then use sort.

Yes I know these are UNIX commands and you're on Windows, but you will find that you have UNIX commands available via MKS Toolkit.