.move(...) can now move into any folder
This commit is contained in:
parent
24f44137a1
commit
b9ec62cbb8
2 changed files with 21 additions and 1 deletions
|
@ -74,6 +74,12 @@ m.create_folder('new_folder')
|
|||
file = m.find('myfile.doc')
|
||||
m.rename(file, 'my_file.doc')
|
||||
```
|
||||
### Moving a file or a folder into another folder
|
||||
```python
|
||||
file = m.find('myfile.doc')
|
||||
folder = m.find('myfolder')
|
||||
m.move(file[0], folder)
|
||||
```
|
||||
### Search account for a file, and get its public link
|
||||
```python
|
||||
file = m.find('myfile.doc')
|
||||
|
|
16
mega/mega.py
16
mega/mega.py
|
@ -370,10 +370,24 @@ class Mega(object):
|
|||
2 : root
|
||||
3 : inbox
|
||||
4 : trash
|
||||
|
||||
or
|
||||
|
||||
target's id
|
||||
|
||||
or
|
||||
|
||||
target's structure returned by find
|
||||
"""
|
||||
|
||||
#determine target_node_id
|
||||
target_node_id = str(self.get_node_by_type(target)[0])
|
||||
if type(target) == int:
|
||||
target_node_id = str(self.get_node_by_type(target)[0])
|
||||
elif type(target) in (str,unicode):
|
||||
target_node_id = target
|
||||
else:
|
||||
file = target[1]
|
||||
target_node_id = file['h']
|
||||
return self.api_request({'a': 'm',
|
||||
'n': file_id,
|
||||
't': target_node_id,
|
||||
|
|
Loading…
Reference in a new issue