How do I check whether a fuse folder is present

◇◆丶佛笑我妖孽 提交于 2019-12-24 15:10:16

问题


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

回答1:


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




回答2:


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




回答3:


You can use:

$path = "/path/to/the/folder";
$name_of_files = glob($path, "*.*");
foreach($name_of_file as $filename)
{
echo $filename;
}


来源:https://stackoverflow.com/questions/12620712/how-do-i-check-whether-a-fuse-folder-is-present

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!