Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > how to get file id in C#
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 15th March 03:22
daniel
External User
 
Posts: 1
Default how to get file id in C#


how to get file id in C#

is there any kind of unique id that can be obtained for any file in a file
system?
  Reply With Quote


  sponsored links


2 15th March 07:31
eric mcp c#
External User
 
Posts: 1
Default how to get file id in C#


Hi Daniel,

When you create a file, you receive a FileStream.
FileStream fs = File.Create(path, 1024))
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIOFileClassCreateTopic.asp


Does this help ?
have fun.
Eric
  Reply With Quote
3 22nd March 02:11
daniel
External User
 
Posts: 1
Default how to get file id in C#


how to get file id in C#

is there any kind of unique id that can be obtained for any file in a file
system?
  Reply With Quote
4 22nd March 15:22
foo
External User
 
Posts: 1
Default how to get file id in C#


Hi,

You can you use hash algorithm, it creates representation of file's content.
It would be unique to all the files. But yuo'll get the same result for the
same file with different name.

HashAlgorithm hashAlgorithm = HashAlgorithm.Create( "SHA1" );
FileStream fileStream = new FileStream( fullFileName, FileMode.Open,
FileAccess.Read );
byte[] hashCode = hashAlgorithm.ComputeHash( fileStream );

Foo
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666