I'm running Raspbian on a Raspberry Pi 2 and I wrote a simple Python script to copy all .png
files from my home directory (~/
) to a predetermined USB drive.
The command I run in terminal works:
cp -r *.png /media/KINGSTON/
In python I have the following:
from subprocess import call
# Some code
call(['cp', '-r', '*.png', '/media/KINGSTON/'])
But when I run the script it says
cp: Cannot stat `*.png' : No such file or directory
I'm definitely in the right directory when I try to copy it. pwd
gives the correct results and ls
shows all the correct .png
files.