Link to home
Start Free TrialLog in
Avatar of yarek
yarekFlag for France

asked on

delphi hiding files

I have read https://www.experts-exchange.com/questions/20561818/Protect-a-folder.html

However MoveFile('your filename', 'your filename' + '.{645FF040-5081-101B-9F08-00AA002F954E}')

only renames the file:

procedure TForm1.Button1Click(Sender: TObject);
begin
MoveFile('test.txt', 'test.txt' + '.{645FF040-5081-101B-9F08-00AA002F954E}')
end;

gives me finally in my explorer "test.txt.{645FF040-5081-101B-9F08-00AA002F954E}" and the file is VISIBLE


AM I doing soemthing wrong ?


ASKER CERTIFIED SOLUTION
Avatar of Scay7
Scay7
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yarek

ASKER

Sorry, I did not get your answer... do you have code source ?
Avatar of wildzero
wildzero

Your code isn't ment for a file, it's ment for a folder
So
Put test.txt into a folder (exmaple, Hideme) then
MoveFile('Hideme', {645FF040-5081-101B-9F08-00AA002F954E}');

This only makes the folder look like a rubbish bin (from memory)  but you still can't see the files..
Create the Folder NOTHIDDEN, put that test.txt into the NOTHIDDEN folder
Now call the same procedure but like this:

procedure TForm1.Button1Click(Sender: TObject);
begin
MoveFile('NOTHIDDEN', 'HIDDEN' + '.{645FF040-5081-101B-9F08-00AA002F954E}')
end;

This example that you searched for was ment for a folder not a file...
So when it calls MOVEFILE it just adds nother "." but with the extension ".{645FF040-5081-101B-9F08-00AA002F954E}"
I think that this extension hides FOLDERS and not files...

Peace Scay7
All I have to do is open explorer, right click and rename the folder (without the extension of course), and I can then access all of the files.  I hope you don't need this to be secure in any way :)
You can try with
SetFileAttributtes(filename, faHidden);
after you move/copy the file;

Regards,
Mishu