I want to save myself a lot of work and use Python to copy all the files with the .RAF extension from all of my external HD's directories and subdirectories to a folder on my MAC's desktop.
import os
import shutil
for root, dirs, files in os.walk("/Volumes/BCKP"):
print(f"In directory {root}, we have files: {files}")
for file in files:
if file.endswith(".RAF"):
path_file = os.path.join(root, file)
shutil.copy2(path_file, os.path.expanduser("~/Desktop/pics"))
print(f"Moving {file}")
However, when I run the code, only small portion of all the specified files are copied to the specified directory.
So for example in folder 2017.01.04 it only copies files from 2017.01.04/Pictures, completely skipping the 2017.01.04/RAW, where actually most of the .RAF files are, and then the program jumps to the next folder:
In directory /Volumes/BCKP/LRbckp/2017.01.04/Pictures, we have files: ['DSCF5741.RAF', 'DSCF5742.RAF', 'DSCF5743.RAF', 'DSCF5744.RAF', 'DSCF5749.RAF', 'DSCF5754.RAF', 'DSCF5757.RAF', 'DSCF5763.RAF', 'DSCF5768.JPG']
Moving DSCF5741.RAF
Moving DSCF5742.RAF
Moving DSCF5743.RAF
Moving DSCF5744.RAF
Moving DSCF5749.RAF
Moving DSCF5754.RAF
Moving DSCF5757.RAF
Moving DSCF5763.RAF
In directory /Volumes/BCKP/LRbckp/2017.04.07, we have files: ['2017.04.07-2.lrcat',
Please help me fix this, I am lost...
P.S. evidence that the folder exists: https://i.stack.imgur.com/fEhLp.jpg https://i.stack.imgur.com/3eZbx.jpg