Link to home
Create AccountLog in
Avatar of raaj4354
raaj4354

asked on

Logic to compare directores

Need to tweak the output for comparing directories using perl.
Avatar of raaj4354
raaj4354

ASKER

I have a build job which

1. Pulls a tar file from the shared folder into the build's directory(called workspace)

2. Explodes the tar file in the workspace.

3. Then executes the rest of the build.

This build mainly builds DML and DDL scripts.If these are build for the second time these scripts will error out.

(Since the table or a row is already created for the first time).

4. Each tar file built will have all the changed files along with the ones that have not been changed.

The whole idea is to build only the new files or changed ones ignoring the files under ora directory that have already been built in the previous file.

The tar file names are typically something like

prodfix_2013_12_somthing-12.tar and the next tar file can be

prodfix_2013_12_somthing-15.tar and the next one could be

prodfix_2013_12_somthing-23.tar

The difference between each tar file is the buildnumber.tar (which increases exponentially)


The build intially should

1.Get the tar file from shared folder. (say prodfix_2013_12_somthing-23.tar cause this will be passed at build time)


The script is needed for logic below.


2.Look for next most recent tar file in shared folder i.e is prodfix_2013_12_somthing-15.tar.(and not prodfix_2013_12_somthing-12.tar) and if present

3.Bring this tar file to the workspace as well.

4. Explode both the tar files and compare "ora" directory in both tar files.

  ---keep the files that are different in both the folders
  ---keep the files that are present only in the new tar file prodfix_2013_12_somthing-23.tar
====Delete all the rest of the files in the "ora" folder.

5. If no recent tar file is present in the shared folder.Do nothing. exit script. In other words if prodfix_2013_12_somthing-23.tar is the only tar file named after

   prodfix_2013_12_somthing. then exit the script normally as this would be the first time its building.

Not sure if the above logic can be implemented in perl.
Avatar of FishMonger
Yes, that logic can be implemented in perl.
ASKER CERTIFIED SOLUTION
Avatar of Suhas .
Suhas .
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer