The exec() function works for changing file attributes in Windows machine as long as the path given is inside the development folder. Like
D:\Programs\Development\www\
as long as the file is within that path it’s attributes can change.
$path = D:\Programs\Development\www\test.jpg
exec("attrib +s +h $path");
That works, but once I change the path to somewhere else this function doesn’t seem to work
$path = 'D:\Desktop\New Folder (2)\Test Folders\test.jpg'
exec("attrib +s +h $path");
Now the same command won’t work. Any ideas on how to solve this?
You need to put the path in quotes.
As with most operating systems, spaces in file names is a problem you have to deal with head on. This is typically done with backslashes, however, since Windows uses backslashes for its folder system, you will need to use quotes.
This should work for you.