473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Random Filenames

Amy
Does anyone know if thier is anything built in the framework to generate
random filenames?

I have a dataset(hash table) that grows very large. After a certain point a
good portion of the elements will not be used anymore until the end of the
program. In order to conserve memory I wanted to write out the current data
in the hash table to a file.

Any thoughts?
Amy
Nov 13 '05 #1
3 10394
Probably not the best way but in one application i did a while ago i
generated a GUID and used that & the current date/time as a file name.

"Greg Ewing [MVP]" <gewing@_NO_SPAM_claritycon.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
Amy, you could use a TempFileCollection to create files whose names are
'random'. You could also use the GetTempFileName method off of the Path
class in System.IO. A third option would be to wrap the win32 API
GetTempFileName(). Hope that gives you some ideas to do what you want.

--
Greg Ewing [MVP]
http://www.claritycon.com/

"Amy" <am**@paxemail.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl...
Does anyone know if thier is anything built in the framework to generate
random filenames?

I have a dataset(hash table) that grows very large. After a certain point
a
good portion of the elements will not be used anymore until the end of

the program. In order to conserve memory I wanted to write out the current

data
in the hash table to a file.

Any thoughts?
Amy


Nov 13 '05 #2
Thanks!
Greetings, timtos.

"Artur Zakrzewski" <Ar*************@hotmail.com> wrote in message
news:#c**************@TK2MSFTNGP10.phx.gbl...
Use System.Guid.NewGuid() method to get a new GUID object.

Regards,

Artur

Użytkownik "timtos" <ha*****@uni-koblenz.de> napisał w wiadomo¶ci
news:be**********@news.uni-koblenz.de...
How did you generate a GUID? I am using DateTime.Now.Ticks as my "GUID" in
one of my applications. Ok for me but not very good :)
Greetings, timtos.

"Arran Pearce" <ar**********@bacoll.ac.uk> wrote in message
news:eH**************@TK2MSFTNGP10.phx.gbl...
Probably not the best way but in one application i did a while ago i
generated a GUID and used that & the current date/time as a file name.

"Greg Ewing [MVP]" <gewing@_NO_SPAM_claritycon.com> wrote in message
news:eY**************@TK2MSFTNGP11.phx.gbl...
> Amy, you could use a TempFileCollection to create files whose names
are > 'random'. You could also use the GetTempFileName method off of the Path > class in System.IO. A third option would be to wrap the win32 API
> GetTempFileName(). Hope that gives you some ideas to do what you want. >
> --
> Greg Ewing [MVP]
> http://www.claritycon.com/
>
>
>
> "Amy" <am**@paxemail.com> wrote in message
> news:uk**************@TK2MSFTNGP10.phx.gbl...
> > Does anyone know if thier is anything built in the framework to

generate
> > random filenames?
> >
> > I have a dataset(hash table) that grows very large. After a certain point
> a
> > good portion of the elements will not be used anymore until the
end of the
> > program. In order to conserve memory I wanted to write out the

current
> data
> > in the hash table to a file.
> >
> > Any thoughts?
> > Amy
> >
> >
>
>



Nov 13 '05 #3
You could try Path.GetTempFileName() under System.IO

"Returns a unique temporary file name and creates a zero-byte file by that
name on disk."

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemiopathclassgettempfilenametopic.asp

Cheers,
Simon.
Does anyone know if thier is anything built in the framework to
generate random filenames?

Nov 13 '05 #4

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

Similar topics

1
by: Oliver Spiesshofer | last post by:
Hi, how would I make a script that pics a random file from a tree? Is there something like this existing? I need one that can handle many files on a large tree. thanks Oliver
4
by: kingofkolt | last post by:
I have a directory of images, called "random". In it are the following files: 1.gif 2.gif 3.gif 4.gif I use this script to choose a random image and display it:
7
by: Robin Becker | last post by:
We've been queried about the randomness of some filenames we're producing. I worked through and seemed to satisfy myself that random is being initialised from the system time in C time(&now)...
2
by: Amy | last post by:
Does anyone know if thier is anything built in the framework to generate random filenames? I have a dataset(hash table) that grows very large. After a certain point a good portion of the...
9
by: Michael Burtenshaw | last post by:
I would like to make a slide show using random images. The problem is my host is 250.com, and they don't support cgi-programs. Is there another way to accomplish random images?
2
by: rbutch | last post by:
guys, i need a little help with this. this is working (well sort of) i get the info, but it's not moving to a new line as it iterates thru the array and all of the fields are like ONE HUGE LONG...
0
by: n33470 | last post by:
We have a web site that is being converted from the 1.1 format into 2.0. I've noticed that after the web project has been converted, the first time that the solution is opened in VS, all of the...
4
by: Scott-ASC | last post by:
I'm looking for some code that will allow me to have a random wav file played every time someone refreshes my home page. I've found some that will allow 5 different wavs (and it wasn't scalable),...
10
by: howa | last post by:
for example, there are 10K files in the directory, given that i don't know if files name, is it possible to fetch a file randomly? thanks.
5
by: Tobi Hammert | last post by:
i just want to show up a random pic. <? $files = glob("./gfx/zufall/*"); shuffle ($files); if (count($files) < 1) $count = count($files); else $count = 1; for ($i = 0; $i < $count; $i ++)
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.