Finding latest file versions

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
muralisankarr
Premium Member
Premium Member
Posts: 83
Joined: Tue Oct 28, 2008 1:55 am
Location: Chennai

Finding latest file versions

Post 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
The minute you start talking about what you're going to do if you lose, you have lost
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply