How do I check whether a fuse folder is present
Domanda
I have a folder mounted on the server that points to an sftp site. I need to check via php whether we can see the folders inside it.
I tried
file_exists("/path/to/the/mount/folder");
but its returning false (which I kind of expected), I can navigate to it through the file system and using terminal.
(also tried is_dir
&& is_link
)
Here's how I mounted it from the shell
echo PASS | sshfs UNAME@URL: /path/goes/here -o password_stdin
Soluzione
This turned out to be a configuration problem.
In /etc/fuse.conf
I uncommented user_allow_other
Then mounted with this command
echo PASS | sshfs UNAME@URL: /path/goes/here -o password_stdin,allow_other
Normal file/folder checking/reading functions will then work fine
Altri suggerimenti
The path should be a string, so:
is_dir("/path/to/the/mount/folder");
Also, if it's unix based I always forget that it's case sensitive :P
You can use:
$path = "/path/to/the/folder";
$name_of_files = glob($path, "*.*");
foreach($name_of_file as $filename)
{
echo $filename;
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow