jne
jne

Reputation: 467

Batch cmd to see if dir exists on remote linux server

I'm looking for a way to check whether a directory exits on a remote linux server from a windows machine. I'm a bit new to batch scripting, done mostly bash.

thanks

Upvotes: 0

Views: 655

Answers (2)

Ras
Ras

Reputation: 547

  1. write a shell script to check if folder exists on linux machine or not.
  2. use plink on windows machine to execute that script remotely on linux

example:

plink.exe -v -pw %Linux_PW% -P %SSHPORT_NO% %Linux_User%@%Linux_Machine% rm -rf %Target_Dir%/*

Upvotes: 0

foxidrive
foxidrive

Reputation: 41234

if exist "\\server\share\folder\" (echo yes) else (echo no)

Upvotes: 2

Related Questions