No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
First, I suggest that you call them 0001.dat, 0002.dat, so that do appear sorted when you use ls. One way, would be to read the directory, sort the files, take the last one and increment it by one. This might become quite long if there are many files. Another way would be to store the last number somewhere (DB, file) whatever. Then, just out of mere paranoia, you can can still check whether the proposed file exists, and increment the number as long as it does:
It is likely that you'll call -e only once, if your stored number doesn't go out of sync. --bwana147 In reply to Re: sequencial file naming
by bwana147
|
|