473,734 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

unique file names

Thanks, this group has been a big help.

I need to create a backup copy of a working file that changes everyday,
but I need to maintain a copy from each day.

Would like to create:
back1.txt
back2.txt
..
..
back56.txt

Is there a way to do this without a while loop and -e test?

Leland
Jul 19 '05 #1
3 5210
LELAND PRINCE wrote:
Thanks, this group has been a big help.

I need to create a backup copy of a working file that changes everyday,
but I need to maintain a copy from each day.

Would like to create:
back1.txt
back2.txt
.
.
back56.txt

Is there a way to do this without a while loop and -e test?


that can cause a race condition so be carefull.

just use a date like:

20030914.back.t xt
--
Kind regards, feel free to mail: mail(at)johnbok ma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/

Jul 19 '05 #2
Keep a separate file of the next available index. Open and lock it exclusive
before making the update. This will have the side benefit of avoiding
multi-thread problems. (That is, if you also modify the process(es) that
modify the working file to also ask for a lock).

"LELAND PRINCE" <ls**@gte.net > wrote in message
news:ho******** *********@nwrdd c02.gnilink.net ...
Thanks, this group has been a big help.

I need to create a backup copy of a working file that changes everyday,
but I need to maintain a copy from each day.

Would like to create:
back1.txt
back2.txt
.
.
back56.txt

Is there a way to do this without a while loop and -e test?

Leland


Ted Hopp
te*@newslate.co m
Jul 19 '05 #3
LELAND PRINCE wrote:

To create unique file names in general please see the advice in PerlFAQ
" How do I make a temporary file name?"
The last section describes how to create unique file names manually.
I need to create a backup copy of a working file that changes
everyday, but I need to maintain a copy from each day.

Would like to create:
back1.txt
back2.txt
.
.
back56.txt

Is there a way to do this without a while loop and -e test?


Just read the directory, pick the (alphabetically ) largest file name, and
add 1.

jue
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1866
by: Victor Engmark | last post by:
How do I define that the contents of an element should be unique only in a sub-tree of the whole XML file? In my case, I have several documents, each containing several files. The file names have to be unique only within each document. I.e., the following is valid: <doc> <file>AAA</file> <file>BBB</file> </doc>
13
1549
by: Jerry Camel | last post by:
I need to be able to generate unique names for files. I was considering that hash alogorithms, but if I had two files with the same name, I'd get the same hash. I am collecting and storing files and I want to store them all in the same directory and I want the names to be cryptic and unique. Any thoughts? Jerry
5
2785
by: deko | last post by:
Is there an accepted or standard way to get a unique name given a string and the collection in which it needs to be unique? Should I use a HashTable? Other options? Here's a first crack: private string makeUniqueName(string inName, MyCollection collection) { //if the name is not unique, append an indexer to the name foreach (Item item in collection)
5
2654
by: EP | last post by:
This inquiry may either turn out to be about the suitability of the SHA-1 (160 bit digest) for file identification, the sha function in Python ... or about some error in my script. Any insight appreciated in advance. I am trying to reduce duplicate files in storage at home - I have a large number files (e.g. MP3s) which have been stored on disk multiple times under different names or on different paths. The using applications will...
4
3825
Ispep
by: Ispep | last post by:
Hi, unfortunately having a bit of difficulty with a question from an Open University course I'm currently doing. If you could help me out in any way I'd be grafeul (though obviously it goes without saying I'm not asking you to solve the question - that won't help come exam time :(). Anyway I have a CSV delimited file in the following format; STRING,INT STRING,INT,INT,INT,INT,INT STRING,INT,INT,INT,INT,INT STRING,INT,INT,INT,INT,INT ...
2
3894
by: banderson | last post by:
Hello, I have a data entry form for a table with information about buildings and am having a problem making a combo box do what I want. I would like to make the combo box show a list of unique bldg mgmt company names and then to open a building management company form to show all records with this name, so the user can find the correct branch location to select. Then, upon closing the building management company form, the active/selected record...
3
1660
by: Mikhail Kovalev | last post by:
I'm storing all uploaded files in one directory -- with the same temporary names they are given by PHP. I do so because I don't want an uploaded file to overwrite an already exisiting one, so I need to know whether these names are unique only per session and can reappear at a different time, or are they unique for every upload... ever? Thanks!=) mvh M. K.
3
1448
by: Jim | last post by:
I'm using framework 3.5, aspx vb and sql server 2005. I have a form that inserts user names. I don't want duplicate names, so how can I make a field be unique? Thanks.
0
1381
by: Gabriel Genellina | last post by:
En Fri, 18 Apr 2008 12:23:08 -0300, Shawn Milochik <Shawn@Milochik.comescribió: A dictionary with keys is perfectly reasonable. But a *list* of values has to be searched linearly for every value: a O(n) process. As your friend suggested, searching a dictionary requires O(1) time. A set is even better in this case, because you don't have any use for the values in the inner dictionary (sets and dictionaries are very similar in the...
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.