I want to run a shell command with laravel Process facade method which moves all files inside a directory to another directory but i get this error:
$process = Process::run(['mv', "Test's Folder/*", 'Folder2']);
dd($process->errorOutput());
mv: can't rename 'Test's Folder/*': No such file or directory
- create a folder with this name Test’s Folder
- add a text file to it
- move them to another directory
>Solution :
The command is executed as expected, apparently both directories do not exist in the public directory of Laravel,. either pass a relative path or a full path.
Here is an example when both directories are in the root directory (same level as public, app. etc..), I had to use .. to step back one time. (tweak the example based on where your folders are by passing the path).
$process = Process::run(['mv', "../Test's folder", '../Folder2']);