UhhNoggy
Posts: 11
Joined: Thu Feb 20, 2014 10:49 pm

File transfer help!!

Mon Feb 24, 2014 10:05 am

Hi guys.
In work i have bee tasked with writing a small porgram
that extracts tar.gz file on to a disk. using the Pi and PiFaceCAD
I have completed this task to their satisfaction. However this
project go me thinking of a small one for myself.

The idea is that using the Pi and PiFaceCAD as a simple file transfer
box. To move all the videos from my GoProHero3 to an external hardrive.
This i can manage but i then thought that what if i want to transfer from a different camera
to the HDD or from the GoPro to a different HDD. The directories will be different.

is there anyway to either just copy from one port and write to another, regardless of what has been
plugged in. such as

move from sda to sda1

or can i right a bit of could that will fill in the blanks with what ever the label of the device is. such as

move from ********** to *********** (using the labels like.' /media/USB' or /media/camera)

an example of the code i want to use is .

Code: Select all

import shutil

source = '/media/gopro'
destination = '/media/HDD'

shutil.move(source, destination)

sorry if i have worded this question badly but i hope you guys can see what i mean

TrevorAppleton
Posts: 74
Joined: Wed May 30, 2012 7:26 pm
Contact: Website

Re: File transfer help!!

Mon Feb 24, 2014 9:09 pm

Hi, I have used shutiil as you mention in your original post. Does that not work for you? You can always rely on os.system

import os
os.system("cp -r /file/structure/one /file/structure/two ")
Check out my blog post for Raspberry Pi and Python tutorials.

http://trevorappleton.blogspot.co.uk/

UhhNoggy
Posts: 11
Joined: Thu Feb 20, 2014 10:49 pm

Re: File transfer help!!

Tue Feb 25, 2014 9:33 am

Well i was looking to use the port id's and it get the error
this is not a directory.
So i didnt want to use the device labels

Return to “Python”