I am working on files n folder using C#….May I know is there any way to get the UID for file-folders….Till now i was using the full path of the file….But my problem in is renaming of files n folder…which will change the UID for file folder..
Plz is ther any way to do the same
thanks in advance
I am working on files n folder using C#….May I know is there any
Share
First, I think you can get clearer responses if you more clearly define what you mean by “working on files.”
No, there’s nothing like a “UID” for file or directories. But if you wish to dynamically monitor the state of files and directories, and have events raised notifying you when they are moved/changed/deleted, etc. You can use .NET’s FileSystemWatcher class.
Using that technique you could start off, for example, with a Dictionary whose key might be some UID or GUID, or whatever, of the form Dictionary<UID,string>, where string might be the original filename. You could then, as you receive events from the FileSystemWatcher, update a second Dictionary<UID,string> where its string might be the changed file path :
I’m not really proposing you specifically use Dictionaries here, but just using them as possible examples of data structures you could create to keep track of certain files by original name/location and by (possibly) changed name/location … or if they are deleted, copied, etc.