The shutil module gives you the functionality to copy files around within a filesystem. You can, for example, do this to copy a file from one directory to another:
Code: Select all
import shutil
original_file = "/path/to/file.ext"
new_file = "/newpath/to/newfile.ext"
shutil.copy(original_file, new_file)
Of course, the filenames and paths would be whatever is appropriate for what you're doing. (Assigning those strings to the variable names is optional-- you can also just put them directly into the shutil.copy() function call.)
I see now it sounds like you want to transfer over a network too, though, so that changes it somewhat. shutil would still be useful depending on how you have your system set up.
RaTTuS asked my major question; in addition, I'm assuming you have a Model B, and it's connected to your network? Another good method (in that case) is to use pyssh, though it would also require an ssh server on your other computer. If it's a Mac or linux box, you're set. For a windows box, there are a few good options, including freessh. Bitvise also makes a good windows ssh server that is free under particular circumstances that you'll likely meet. Yet another option using ssh would be to mount your computer's destination directory to your RPi with sshfs, then you can just treat it as though you're moving/copying files around on the local filesystem. Very cool functionality.
Alternatively, it could be a fun project for you to just write a python program on each side (you'll need python on your destination computer as well) and use the python socket module to transfer data directly using UDP or TCP. If you're willing to get your hands dirty, that is.
