Searching for a file in the computer

[closed my old post since it it has insufficient explanation]

Hi everyone,
I have a program which generates a string for the file entered.
(The length of the string will be equal irrespective of the file size)Here the path of he file is to be entered specifically for generating the string.
And I have to give the path of the second file to compare those two files and thereby declaring those two files are same.

Now, I have defined the string value for the second file in my program and I want the get the string values of all files present in the computer so that I find the presence of file in the system.

"FindFirstFile" function is is used for searching the whole computer by the name of the files but I want to search the file by its string value generated by my program.

how can I achieve this? Can you suggest any ways, methods, functions,links, etc.,

Thank you in advance.
[Update]
Here is a brief explanation of my problem:

My program will generate a string e.g "7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48" for the file entered. The string value does not depend on file name, extension etc.,

example :

example.exe = 7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48

and the file is renamed to test.exe without modifying the contents of the file .The output will not change

i.e test.exe = 7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48

But when the contents of the file is modified the output will be modified.

So here is were I have been struck:

My program will check the string value for the two files and check whether those to files are same.

Here I have to enter the location of two files specifically for confirmation. But I have defined the string value of one file in my code

like string a =7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48;

and I have to make my program to get the string value for each and every files of the computer on which my executable runs and find the string which matches the string a.
so you need to generate a string value for every file in the computer then find match?
Yes, that is what I need. What should I do now? Any suggestions?
Last edited on
Just do it the same way you generated the string for the first one - am I missing something?

If you are stuck for a way of generating the string in the first place, try something like a checksum or crc that will generate a unique value based on the file contents
you could invoke any number of shell utilities from within your code (md5sum, crc32, etc.) or just implement your own.
Hi,
quote : "am I missing something"
Yes you're. My problem is generating strings for all the files present in the computer.

example:

If my executable runs on a computer which has 4drives (C:\,D:\,E:\,F:\) and has 1,00,000 files on each drives(C,D,E,F).

So total no.of files present in the computer is 4,00,000 and I need the string to be generated for all 4,00,000 and compare with my string.

I have already achieved in generating the strings for the file which I enter manually. But I need to make my program automatic.

Since I am not a native English speaker I could not make something clear so i gave the below thing
At present output of my program is like this:

//Note: I have initialized a string in my program like this string a = AGKNKHkHKHKKHK
//String of the test.exe file: AGKNKHkHKHKKHK

[output]
Location: C:\\test.exe //***To be entered manually**
Result: matches.

I need my program to be like this:

searching for the file... //searches the whole computer for the file with the string "AGKNKHkHKHKKHK"
the file C:\\Users\\User\\hnj.bat matches

Thank you everyone for helping me.

Last edited on
Topic archived. No new replies allowed.