1

I have a directory containing files that are owned by root, from this directory I wish to copy all the files ending with errorAll to another directory. My wildcard syntax is correct because performing a ls -latr *errorAll shows all the files that I want to copy.

Attempting to copy (as non root level user) using cp *errorAll ~/Target/ gives me the expected warning of cp: cannot create regular file /home/tarskin/errorAlls/calibrated_20130903_healthy#1-b_IgA_again_1401_C10.errorAll: Permission denied, I just added this step to show that the command should be working (in my opinion).

However when I then run it as a root level user using sudo cp *errorAll ~/Target/ it doesn't give any message or error and just claims it's done within seconds without having actually copied anything.

Does anyone know why this occurs?

EDIT

The following information was requested, output of ls -ld . is drwxr-xr-x 2 root root 3342336 Oct 22 10:09 . The output of ls -ld ~/errorAlls/ is drwxr-xr-x 2 root root 3342336 Oct 22 10:09 ..

Adding -v to the cp command for verbose output doesn't change anything, the command 'finishes' without doing anything.

3
  • Add the output of ls -ld . and ls -ld ~/Target/ to your question.
    – Cyrus
    Oct 23, 2014 at 9:50
  • Add "-v" to the cp command to see what it is actually doing. Oct 23, 2014 at 11:43
  • 1
    Why is a subfolder under tarskin's home owned by root? sudo chown tarskin /home/tarskin/errorAlls and then cp *errorAll ~/errorAlls.
    – NuTTyX
    Oct 23, 2014 at 17:59

1 Answer 1

0

Try it recursively

sudo cp -r *errorAll ~/Target/
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .