0

I have a folder structure that is something like this:

a/
 |b/
   | f1
   | f2
 |c/
   | f3
   | f4
 |d/
   | f5
   | f6

Where b, c, and d can contain main files and sub directories. Then I have a destination folder e, where the destination folder e exists. When I run cp -r a/c e/ or cp -r a/d e/ c and d are copied to e as I expect, with their internal folder structure. However, when I run cp -r a/b e/ the result is not the same. Only the content of a/b is copied but not b itself. It is almost like the command that is run is cp -r a/b/* e/

I cannot see anything special about the folder with ls or file. It has the same rights as c and d and is shown as directory when I run file on it.

Is there a way to debug what is happening? I first experienced the problem running copy from python using subprocess:

import subprocess
import pathlib

for folder in pathlib.Path("a/").iterdir():
    if folder.is_dir():
        subprocess.run(["cp", "-r", str(folder), "e/"])

afterwards I tried to run the command cp -r a/b e/ from the command line and had the samme issue.

0

1 Answer 1

1

Apparently the machine has a service running that deletes empty folders every X seconds. Therefore, the copy of b happened after e had already been deleted. Resulting in this behavior I described above.

You must log in to answer this question.

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