0

I want to test whether some paths are mapped onto remote shares before creating them, as they need to be created before their files are written two. They are sshfs paths for the time being.

A basic idea would be to check /etc/mtab and look for share a whose path is a long enough prefix for the path I'm testing, but I'm hoping that there is something which is more robust than something I will whip up at short notice.

vfclists
  • 7,215
  • 14
  • 51
  • 79
  • 1
    Does [this answer](https://unix.stackexchange.com/questions/20523/how-to-determine-what-filesystem-a-directory-exists-on) help? – dirkt Sep 12 '21 at 06:09
  • @dirkt Not quite. It is not to check if the directory exists. It is to check if it would be on the remote share if it was created – vfclists Sep 12 '21 at 11:04
  • Then check the prefix of that path that **does** exist in the above way, because that prefix determines on which filesystem (or "remote share") it would be created. Unless you have some weird automount setup going on where non-existing paths will get automounted as soon as they are created. But in that case you need to check the automount configuration, anyhow. – dirkt Sep 12 '21 at 13:03

0 Answers0