Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP windows create hidden files

Is it possible to create hidden files/folders on windows using php (xampp)? And if it is, how?

like image 384
Tiddo Avatar asked Feb 08 '11 16:02

Tiddo


2 Answers

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.

like image 88
alexn Avatar answered Sep 21 '22 17:09

alexn


You could call attrib:

$filename = 'c:\\some\\file.txt';
exec('attrib +h '.$filename);
like image 32
ircmaxell Avatar answered Sep 21 '22 17:09

ircmaxell