What is cp: cannot stat error in Unix, I get this error when trying to copy thing from one folder to another What is cp: cannot stat error in Unix, I get this error when trying to copy thing from one folder to another bash bash

What is cp: cannot stat error in Unix, I get this error when trying to copy thing from one folder to another


If your source directory is set in quotes, then make sure that the * is outside the quotes, i.e.

cp "source/"* dest

or

cp "source"/* dest


cannot stat = file/dir does not exist. Check the path first.

And, you say you want to copy /mock but the error message says mock. Show the real code first.

When I test in ubuntu, cp (GNU coreutils) 8.28, I have no problem with copying all files under a dir to another dir, when both paths are correct.

root@DESKTOP-9NHNV2I:~# cp /root/temp/* /rootroot@DESKTOP-9NHNV2I:~# lstemp  test.txt  test2.txt  test3333.txt


cp is used in unix/linux for copy

cp /mock/* ~/projweek this means copy from /mock folder all files to folder projweek that resides in root

This means cp: cannot stat ‘mock/*’: No such file or directory unable to copy all files from mock folder because file or directory not exists on relevant path