About File And Folder Operations

About File and Folder Operations

Contents

copy

copy method copies a file or folder.

Code Sample

cloud.copy('/path/to/source/file', '/path/to/destination')

create_folder

create_folder method creates a file or folder.

Code Sample

cloud.create_folder('/path/to/newfolder')

delete

delete method deletes specified file or folder.

Code Sample

cloud.delete('/path/to/file')

File Download

download_url method retrieves the download URL that you can use to download a file.

Code Sample

# get a download URL by path
url = cloud.download_url(path='/path/to/file');

# get a download URL from by passing a CloudFile object
url = cloud.download_url(file=cloud_file)

# get a download URL directly from a CloudFile object
url = cloud_file.download_url()
```	

## File Upload 

[`upload`](../../Python_Reference/Cloud/) method allows you to upload a file.

**Code Sample**
	
```python

# upload a file that is already opened
local_file = open('sample-files/some-file.txt', 'rb')
file_uploaded = cloud.upload(local_file, '/VZMOBILE/destination/folder')

# upload a file from a path
file_uploaded = cloud.upload('sample-files/some-file.txt', '/VZMOBILE/destination/folder')

Fullview

You can call fullview method to download the information on all files and folders within a user’s Personal Cloud Storage account.

A successful cal to fullview returns a list of files, folders, and an etag. You can use the etag to retrieve the changes to the files and folders made between two fullview calls.

The following code samples show calls to fullview API with and without an etag.

Fullview

Code Sample

files, empty_folders, etag, deleted = fullview()

Fullview with Delta

Code Sample

new_files, new_empty_folders, new_etag, new_deleted = fullview(etag)

move

move method moves a file or folder.

Code Sample

moved_file = cloud.move('/path/to/source', '/path/to/destination')

rename

[rename]() method renames a file or folder.

Code Sample

renamed_file = cloud.rename('/path/to/source', '/path/to/destination')

Copyright © 2015-2017, Verizon and/or its Licensors. All rights reserved.