unambiguous identification of file

prometro

Registered User.
Local time
Today, 17:14
Joined
Aug 29, 2006
Messages
55
Hi ms access friends!

Is there possibility to do unambiguous identification of file in vba ?

I mean this :

- at the beginning you have file on hard drive, ex. : aaaa.doc
- some time later you will do some change, for ex: change of its name to bbbb.doc or you add some text in word document ...

I need to do some code for finding files although their names or content
was changed.

Thank you for help me with it

Jiri
 
It is no question here to find a file if you modify the content but not the name, isn't it ?

So the question remain only for files that was renamed
As far as I know, is no way to do this.

Windows provide a Search tool.
Of course you can design (with a lot of code) your own Search tool.
But I have huge doubts that you can obtain better results than Microsoft' guys.
 
- at the beginning you have file on hard drive, ex. : aaaa.doc
- some time later you will do some change, for ex: change of its name to bbbb.doc or you add some text in word document ...

I need to do some code for finding files although their names or content
was changed.

Use a source control system or content management system? In principle I think it's possible to use the NTFS journalling features to track changes to files but using a content management system of some kind is probably easier and would give you a richer set of features.
 
Thank you for answers!

I will try to explain my problem better.

For example :

I have file 200 MB on my HDD and I will backup it by backup software to external drive.
Then I do change of file name on HDD or I do change of its location to other directory.
When I start backup software again the program do new copy on external drive, because it dont recognize that file is the same - the most easier way is to do change name of file on external drive or move file to relevant directory and not to do new copy - doing copy takes so much time!
... if you imagine that I have so many files with big size.

I am sorry my english, I hope it is good for understanding.

I am new in backuping software problematic, but i didnt find any tool which can do changing file names or directories instead of doing new copy unnecessarily.

That is why Iam trying to do my own program - and only language I learned is VBA and access enviroment.

Maybe it is not good idea, maybe there is some good backuping software I didnt find yet, ...

Mihail : I do mistake - I thought only changes of file name or location in directories - and not content.
Jiri
 
Mihail : I do mistake - I thought only changes of file name or location in directories - and not content.
Once, long time ago, I've make a program (in VB 6 or 5) in order to compare, byte by byte, 2 files.
I remember that was not a simple task.

From the top of my head I can say this:
1) Create a function to locate, one by one, all files in a "folder". (As example, C: is a folder. And MyComputer is another one).

2) Open the file that should be compared.
Use a DO - Loop
3) Open, one by one, the files founded in step 1)
4) Start to compare, byte by byte, the 2 files.
In order to decrease the necessary time:
- Compare the files length. If lengths are different then the files are not identically.
- Compare only 10 or 20 % from the length of files
Loop

I'm sure that this can be accomplished from Access VBA.
But, I repeat, is not a simple task.

Good luck !
 
You can simplify your problem by testing whether the files are the same on your backup medium vs. the file's original location. No change? No need to backup! A fast way to determine whether files have changed in content IF YOU CAN GET TO these features...

If you have OpenSSL on your system, this is easy. If you have to use .NET to do it, it gets harder because of the requirement to use PowerShell scripting. Some other tools also do this and are easy enough to download for free. Search for "encryption tools" because this feature is generally part of an encryption suite.

To determine if a file has changed, you need to generate something called a file hash. You can build a list of files to be checked and store a hash value for each one. You get there by using something that generates a value technically called a message digest (but its common name is file hash.)

The idea is that you generate a hash on file X today. If file X did not change today, the hash will not change either, so if you generate a new hash tomorrow and it matches today's value, nothing changed. You don't compare the files. You compare the hashes. Further, the design of most hashes is such that the hash value DOES NOT change if all you did was change the file name.

You don't really care WHAT the hash value is, all you need to do is store it, which you can do by allocating a string for it. For MD5, you can EASILY store the value of type "string" for your file. I think it prints as a string of 32 hex digits. Then just compare hash string A to hash string B. Equal or not equal. End of discussion.

The trick is to generate the hash, usually which requires you to create a shell to execute a DOS-level (batch level) command. I don't know what is available to you, but .NET should be there and OpenSSL is not unheard of. You could have other tools, and my problem is that I can't even begin to guess what you have or how to use it.

Let's say that you ran a hash for your big file. It generates a fixed-size hash string, because that is the nature of the hashing algorithm. There is a small but non-zero chance that you will get a hash collision - which means that two different files using the same hash generator came up with the same hash value. If I recal the odds correctly, you have something like 1 chance in 2 to the 128th power or about 3.4 times 10 to the 38th power (very roughly speaking) to have a false report of "no change" when the file actually changed.

You can also use the File System Object ("FSO" - and you can look it up online) to determine the date of last modification for a file. Backing up a file doesn't normally change it, so if you know that a file was backed up yesterday and its last modification date is day before yesterday, you might guess that the file didn't change in the last 24 hours.

Using the FSO, you can do fairly easy file manipulation, name testing, path testing, and attribute testing. The FSO methods and properties might be good tools to put into your VBA toolkit.
 
I'm sure that this can be accomplished from Access VBA.
But, I repeat, is not a simple task.

Good luck !

Thank you for reply,

yeah, it seams to be hard task - Iam afraid that it is so big
for my knowledge now.

But Iam patient so maybe one day I will do it.

Jiri
 
Thank you Doc Man for the comprehensive answer!
I read so slow in english so it takes me some time to read ... if i do some steps i will reply.
Jiri
 
but if you rename a file, there is no way of determining what the previous name was, for back up purposes. A backup system will make a new copy of this file.

I imagine the only thing you could do is examine your backup set, and delete any backup files where the original no longer exists.
 
but if you rename a file, there is no way of determining what the previous name was, for back up purposes. A backup system will make a new copy of this file.

I imagine the only thing you could do is examine your backup set, and delete any backup files where the original no longer exists.

Hi,
yes, thats the problem. Imagine that you have a file 2GB on HDD. You do backup to external drive. Then you change the name of this file and run backup software again.
Backup software do new copy unnecessary althought it would be easier to only rename file on external drive - it takes so much time.
Pity that each file has not its own ID...
 

Users who are viewing this thread

Back
Top Bottom