3

I need to transfer files over sftp in laravel. By now, I've been able to upload and download a single file with SSH facade such as

SSH::into('staging')->put('somefile', 'copyfile');
SSH::into('staging')->get('somefile', 'copyfile');

But my problem starts when I try to upload/download several files. I make something like

SSH::into('staging')->put('somefolder/*', 'somedestfolder/');

But nothing happens and Laravel documentation I found in

http://laravel.com/docs/4.2/ssh#sftp-downloads

Does not help much.

I was able to run a ssh session and do a cp command, but I'm not sure I could do this in the production server.

Does anybody know how to do it this?.

Kenster
  • 23,465
  • 21
  • 80
  • 106
Dhouard
  • 165
  • 16
  • This is not how a copy process works, regardless of locally or using a remote connection. The wildcard operator is always resolved _before_ the actual copy command is seeded with arguments. Typically that is done by the shell you start the copy command in, so in your case the php script. So that means that you have to resolve the wildcard operator first and then feed single arguments to your operations. – arkascha Nov 13 '15 at 13:04
  • Do you mean getting a directory listing first and then do a "put" for every single file?. If so, how do I get that directory listing from laravel? – Dhouard Nov 13 '15 at 13:12
  • i'm having the same question, by any chance you managed to do it the laravel way? – SagarKapasi099 Aug 14 '19 at 10:17

0 Answers0