0

I want to get the last folders name from a pi and this commands works just fine:

ssh [email protected] 'ls -t /media/usb/Pictures/new/ | head -1'

Returns: 230125_1356

To retrieve the number of files in that folder I'm using:

ssh [email protected] ls -t /media/usb/Pictures/new/$(ssh [email protected] 'ls -t /media/usb/Pictures/new/ | head -1')/ | wc -l

Returns: 5

But now I'm trying to get the same results from another pi connected to the first one: This one works fine and gives me the name of the last folder:

ssh -t [email protected] ssh [email protected] 'ls -t /media/usb/Pictures/new/ | head -1'

Returns: 230125_1356

My problem arises when I try to get the number of files inside the last folder over the second pi with:

ssh -t [email protected] ssh [email protected] ls -t /media/usb/Pictures/new/$(ssh -t [email protected] ssh [email protected] ls -t /media/usb/Pictures/new/ | head -1)/ | wc -l

Returns: 1

The return should be 4 which is the number of files in that folder.

Any help will be much appreciated. Thanks.

Mark
  • 1

0 Answers0