Checking existence on remote server
Hi,
How can I check the existence of a file or a directory on a remote server ? I though it would be the following but it's obviously not quite right :-) if [ ! -d 172.16.15.9:/home/mike ] ; then....... Thanks Mike |
There's prolly "better" solutions, but this file example does work:
res=($(lynx -dump -head proto://fqdn/file | grep -m1 "^HTTP/")) case "${res[1]:0:1}" in 1|2) echo Got it;; 3) echo Look somewhere else;; 4|5|*) echo Aint got it;; esac |
You can do something like
ssh host perl -e 'print ((-f /tmp/file) ? "true" : "false");' But A.) That syntax may be a bit off B.) You'd have to setup non-password SSH access to host |
All times are GMT -5. The time now is 03:43 PM. |