Operating System - HP-UX
1834590 Members
3546 Online
110069 Solutions
New Discussion

Re: files with the same name in a directory

 
Jimmy_13
Advisor

files with the same name in a directory

Is possible that some versions of a text file is in the same directory with the same file name?

I need that all versions del file have the same name how: "file1"

For read the old versions of the file i need use the same name, maybe with a flag or parameter that said the versions.

It is for a migration from Mainframe a Unix, and i have to simulate this "file versions" that work en the mainframe.


8 REPLIES 8
Marco Santerre
Honored Contributor

Re: files with the same name in a directory

I'm not sure I understand this correctly but if I follow what you are saying, you want to be able to have the same file name in the same directory except that you want to have version numbers?

If that is the case, you could always have the same filename, let's say for example "file1" and have an extension tot he filename with the version number so you'd have a directory that would look like this

file1 (current version)
file1.001
file1.002
file1.003
...

that is possible
Cooperation is doing with a smile what you have to do anyhow.
A. Clay Stephenson
Acclaimed Contributor

Re: files with the same name in a directory

Unix has no notion of file versions e.g. file1;1 file1;2 file1;3. Moreover, duplicate directory entries are not allowed. Your only option is to come up with a scheme to append a suffix to the filenames.
If it ain't broke, I can fix that.
John Bolene
Honored Contributor

Re: files with the same name in a directory

You can also do something like

file1.datetime for the version number system

I come from a UNISYS that had a file version system probably like you had and this is what we used when we went to UNIX.

It is easy to sort the directory and pickup the last one by date time.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com
Jimmy_13
Advisor

Re: files with the same name in a directory

I can use the name files like:
file1.001
file1.002
...
for the differents versions.

But, the developers of the migration ask me if only with the file name "file1" they can access to old versions.

I think that it isn`t posible.

What do you think?
James R. Ferguson
Acclaimed Contributor

Re: files with the same name in a directory

Hi Jommy:

If your developers insist on keeping the same filename, then they will have to place the different versions in different directories. Such directories could even be subordinate to the "current" version:

For example:

/tmp/file1
/tmp/v1/file1
/tmp/v2/file1
/tmp/v3/file1

As already noted, the filename *must* be unique within a directory.

Regards!

...JRF...
Marco Santerre
Honored Contributor

Re: files with the same name in a directory

i'll have to concur here that the only way you could have the same filename would be to actually have a directory that would represent your version numbers. Unless you write a script that allows them to view a file which you would pass a parm which would say which version and you would translate that into the version number and append it to the filename.
Cooperation is doing with a smile what you have to do anyhow.
Chris Vail
Honored Contributor

Re: files with the same name in a directory

Some of these other guys may know better than I about this, but methinks SCCS can control file versioning. I've never installed or used it, but thats one of its selling points.


Chris
Jimmy_13
Advisor

Re: files with the same name in a directory

Cris, I were search information about sccs and discover that there is a sccs unix command.
Hp-ux has this command too.

Sccs command should create files whith the same name, i am trying of understand how work.

Somebody know how use sccs command?