2

I'm writing an artisan command in Laravel 5.5. There are files in an AWS EC2 instance and all within the same folder, my command needs to download all those files into a local storage/folder. I went through the Laravel's documentation but couldn't find helpful info. I have added a disk into my filesystem config file for my local storage/folder access, as well as a disk for my AWS SFTP server. Previously I've been doing this using the phpseclib but would like to move on using Laravel in Laravel way. I've tried the following:

Storage::disk('aws')->get('path/filename.ext');

which throws the following exceptions:

In FilesystemAdapter.php line 109:
path/filename.ext

and

In Filesystem.php line 388:
 File not found at path: path/filename.ext

but I can see the file is there and my program can download it, and actually all of them using phpseclib.

and also tried the following which returns an empty array:

Storage::disk('aws')->files('folder-name');

and aws is the disk I've defined in the filesystem config file as follows:

'aws' => [
    'driver' = 'ftp',
    'host' = '12.123.123.12',
    'username' = 'myusername',
    'password' = 'mypassword'
 ]

Thank you!

Bahman.A
  • 1,166
  • 4
  • 18
  • 33
  • 1
    do you want to generate link for those files ? have you linked your storage folder by php artisan storage:link? – fahim152 Nov 19 '19 at 02:07
  • I don't want to generate links I just need to download them all to the local storage into a specific folder, and the point is that I want to download all the files without knowing their names. I'm not sure about storage:link as I didn't see that in laravel's documentation about filesystems, would you please elaborate on that a little more? thanks! – Bahman.A Nov 19 '19 at 02:11
  • oh if you want to download all files why dont u use putty or filezilla ? – fahim152 Nov 19 '19 at 02:13
  • 3
    @fahim152 you should read my question more carefully. I'm creating Artisan Command and files need to be downloaded and procesed by the command. – Bahman.A Nov 19 '19 at 20:25

0 Answers0