Cygwin SSH to read subfolders and files
by misurex2 from LinuxQuestions.org on (#52FVQ)
Hello,
From Centos7 I'm connecting to Windows 10, through SSH, to read and then save to a file (on Linux) all the content of a certain directory, meaning sub-directories and their files.
I created a bash file like this:
Code:#!/bin/sh
rm -f /media/my_file.txt
HOST="MY-PC"
ssh user@$HOST "dir H:/Documents /s /a /b">> /media/my_file.txtThe problem is that cygwin give those errors:
dir: cannot access '/a': No such file or directory
dir: cannot access '/s': No such file or directory
dir: cannot access '/b': No such file or directory
NOTE: I already can read without problems the hardware information of the mentioned pc, so it's not a SSH problem.
I tried all sort of variants(like putting the command in a variable, commenting the slash, adding simple quotes, replace the slashes by hyphens), but nothing worked. Please guide me through this.
Thank you.


From Centos7 I'm connecting to Windows 10, through SSH, to read and then save to a file (on Linux) all the content of a certain directory, meaning sub-directories and their files.
I created a bash file like this:
Code:#!/bin/sh
rm -f /media/my_file.txt
HOST="MY-PC"
ssh user@$HOST "dir H:/Documents /s /a /b">> /media/my_file.txtThe problem is that cygwin give those errors:
dir: cannot access '/a': No such file or directory
dir: cannot access '/s': No such file or directory
dir: cannot access '/b': No such file or directory
NOTE: I already can read without problems the hardware information of the mentioned pc, so it's not a SSH problem.
I tried all sort of variants(like putting the command in a variable, commenting the slash, adding simple quotes, replace the slashes by hyphens), but nothing worked. Please guide me through this.
Thank you.