Checking if a file exists on my computer is easy. But how about checking if this file exist on my server?
If my file is:
host@server:/path/to/my/file.txt
What do I need to do to check if it exists?
Checking if a file exists on my computer is easy. But how about checking if this file exist on my server?
If my file is:
host@server:/path/to/my/file.txt
What do I need to do to check if it exists?
How about this?
ssh user@host 'if [ -f /path/to/my/file.txt ]; then echo yes; else echo no; fi'
Something like this could help -
ping -c 1 ipaddress && ssh user@host 'test -e /path/and/filename && echo exists'