1.

Solve : Check file exists on Remote Server?

Answer»

Hi all,

I need to check if a file is exist on a remote SERVER or not , I am using the following code :
Code: [Select]if [ -n `ssh $hostname 'ls /usr/local/file 2>/dev/null'` ]; then
echo file exists
fi/code]

The code is working fine, but now I have files NAME like
text1_progress
text2_progress

So I need to check that if file name having *_progress is exist or not, How to check this?

THANKS in AdvanceHave you tried 'ls /usr/local/\*_progress 2>/dev/null'?  I'm not sure at what point the command interpreter expands the wildcard.

You could also potentially use rsync to perform this test, with the --dry-run flag.



Discussion

No Comment Found