Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: incrementing the file

by lune (Pilgrim)
on Feb 22, 2012 at 13:06 UTC ( #955516=note: print w/replies, xml ) Need Help??

in reply to incrementing the file

The problem with your approach is, that you have to check an ever growing number of files to determine the current version. The alternative is of course some kind of bookkeeping.

The simplest form I could think about is using a "output_$input_file_current" with a symlink to the real file "output_$input_file_$version". That way you only have to get the real file name of the symlink with readlink to determine the current maximum.

Replies are listed 'Best First'.
Re^2: incrementing the file
by nemesdani (Friar) on Feb 22, 2012 at 13:28 UTC
    Or create a last.txt, containing the name of the latest file. Your open it at the start of your program, overwrite and close it at the end. Not very elegant, but simple and robust.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://955516]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2022-05-24 12:47 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (82 votes). Check out past polls.