In our .net application we have to run file operation commands against Unix system. I am trying to have equivalent of File.Exists and Directory.Exists.
Using ssh in in .net, got to work so far in following way:
Find only files with matching name:
find /folder/subfolder -maxdepth 1 -type f -iname test.mov
Find only directories with matching name:
find /folder/subfolder -maxdepth 1 -type d -iname test
Question – Is it possible to do above operations without splitting full path?
It is not big deal to split the path but existing service in production accepts only command to run and the path.
return true or false – i.e. directory.exists
same for files
You can use these constructs to return ok or not ok
find does not return an error when it cannot find a named directory or file