cp: cannot stat 'filename': No such file or directory

complete noob here, so thanks for your help ahead of time.

A using Linux in my chromebook and trying to intstall Vuescan.

The installation has told me to enter the following:

sudo cp vuescan.svg /usr/share/icons/hicolor/scalable/apps/

Yet when I do that I get:
cp: cannot stat ‘vuescan.svg’: No such file or directory

I’ve searched for hours to try and find a solution but to no avail.
Here’s what’s in my folders.

robwilton@penguin:~$ pwd
robwilton@penguin:~$ ls



See attached a screenshot.

enter image description here

Any help or suggestions is much appreciated.

Thank you!

Asked By: RobWilton3000


I am not familiar with running Ubuntu inside a ChromeOS. It looks to me the folder VueScan exists in two places:

  1. In the screenshot, the file manager shows the location as: My files/Linux files/VueScan

  2. Based on the output of the pwd and ls commands the location is:


It is possible ChromeOS and Ubuntu denotes the file locations slightly differently. These two are the same location. I will assume that they are.

Method 1: Change directory and then copy:

Step 1: Change directory to VueScan in the terminal

Open a terminal (if not already open) and enter:

cd VueScan

Note, Linux files are case sensitive. VueScan and vuescan are completely different folders or files. So type with care. When you type the above command and press Enter the command prompt will change from:




Now you know that you are inside the ~/VueScan folder.

Step 2: Copy the files as directed:

Now you can follow the instructions and use the cp command to copy the files in the location specified. For example:

sudo cp vuescan.svg /usr/share/icons/hicolor/scalable/apps/

Now the above command should work, and the file vuescan.svg resides inside the folder ~/VueScan and you have entered this folder.

Note: Normally when a file is successfully copied you don’t get a confirmation. Only errors are reported by default.

(Advanced) Method 2: Copy with relative or absolute file path

You can avoid the change directory, cd command and use just the copy, cp command and tell the command where the source file is:

sudo cp ~/VueScan/vuescan.svg /usr/share/icons/hicolor/scalable/apps/

Note the upper and lower cases in the folder and file names. Also do not forget the ~ and the / before the folder name. The ~ stands for your current location, which is /home/robwilton. I know this from the pwd command output.

So another way of specifying the source file location is:

sudo cp /home/robwilton/VueScan/vuescan.svg /usr/share/icons/hicolor/scalable/apps/

Now you can copy all the files to their respective location by using one of the two methods.

Hope this helps

Answered By: user68186

I am trying to do a simple task using a bash script which is copying a few files to a different directory in an automated way (i am a beginner on bash).

Folder structure

   |-- output/
   |-- snaphu/

The task is the following: The script should go in each folder within snaphu/ directory (there are two folders as we can in the diagram above) copy the file name starts with UnwPhase_ifg and end with .hdr and paste it in the directory snaphu/. So, in the directory snaphu will have the following two files:

UnwPhase_ifg_VV_05Jan2021_17Jan2021.snaphu.hdr UnwPhase_ifg_VV_05Jan2021_29Jan2021.snaphu.hdr

Below we can see the code i wrote to do that. When i execute the script, i get the following error:

cp: cannot stat 'output/snaphu/S1A_IW_SLC_20210105_20210129/UnwPhase_ifg_VV_05Jan2021_29Jan2021.snaphu.hdr': No such file or directory

When the echo command runs, both files(the one starts with UnwPhase as stated above) are successfully found within each folder (S1A_IW_SLC_20210105_20210117 and S1A_IW_SLC_20210105_20210129) which means the path is correct but it fails to copy them. There must be something obvious that i am missing. It is quite frustrating for me not to be able to do something that it sounds easy.
I would appreciate any help

target_infs=($(find "${target}"))
cd $target_infs

for i in $(ls -d */)
   UnwPhase=($(find ${i} -name UnwPhase*.hdr))
   cp  $UnwPhase "output/snaphu/"
echo $UnwPhase
Answered By: Ioannis
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.