flying-circus / pyfilesystem

Automatically exported from code.google.com/p/pyfilesystem
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

fs.base.copy should handle absolute file names too #90

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Would it not be logical if the copy function would also support copying files 
from the filesystem into the PythonFS and from PythonFS to the filesystem?

The following should work:
fs - is some Python FS

fs.copy('/tmp/sometempfile.tmp', 'dir1/temp/tempfile1.tmp')
fs.copy('dir1/temp/tempfile1.tmp', '/tmp/sometempfile1.tmp')
fs.copy('/tmp/sometempfile.tmp', '/tmp/sometempfile2.tmp')

Also - how would one copy a file between two different PythonFS instances?

Original issue reported on code.google.com by aigar...@gmail.com on 14 Nov 2011 at 2:19

GoogleCodeExporter commented 9 years ago
That would not be consistent with the sandboxing notion that PyFilesystem 
implementations follow. Basically, if you have an FS object you should be 
confident that you can't modify anything outside of the files it represents.

Check out the fs.utils module (http://packages.python.org/fs/utils.html) for 
copying between filesystems.

Original comment by willmcgugan on 14 Nov 2011 at 2:31