'Python rglob("*") vs glob("*)

I am trying to move a bunch of files with "V1.2" in the name to an archive folder. It seems to be working fine with the following code:

for folder in copyPath.glob("*"):
    for subfolder in folder.glob("*"):
        for content in subfolder.glob("*"):
            if "V1.2" in content.name:
                shutil.move(content ,Path(subfolder,"Archive"))

However, the following code with rglob("*V1.2*"), python just creates an "Archive" named extentionless file into the archive folder. Why is that?

for file in copyPath.rglob("*V1.2*"):
    shutil.move(file,Path(file.parent,"Archive"))

Regards, AS



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source