Article 52FVQ Cygwin SSH to read subfolders and files

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.latest?d=yIl2AUoC8zA latest?i=3UiTENl9TpI:TtUIsh3Y5tE:F7zBnMy latest?i=3UiTENl9TpI:TtUIsh3Y5tE:V_sGLiP latest?d=qj6IDK7rITs latest?i=3UiTENl9TpI:TtUIsh3Y5tE:gIN9vFw3UiTENl9TpI
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments