Is it possible to create hidden files/folders on windows using php (xampp)? And if it is, how?
A file in Windows is hidden if it has the hidden attribute set on it. There is no built in function to do this, so you need to use system/exec to execute the attrib application. Like this:
$file = 'test.txt';
system('attrib +H ' . escapeshellarg($file));
This will set the hidden (+H) flag on test.txt.
You could call attrib
:
$filename = 'c:\\some\\file.txt';
exec('attrib +h '.$filename);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With