Last active
December 28, 2023 19:35
Revisions
-
hkulekci revised this gist
Dec 28, 2023 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ ## Some commands for NextCloud After downloading the files from Box you can insert into NextCloud through command line : ``` # invalid character problems # Entry <> will not be accessible due to incompatible encoding convmv -f utf-8 -t utf-8 -r --notest --nfc <folder> # Scan for next cloud cd /var/www/nextcloud sudo -u www-data php occ files:scan <username> ``` -
hkulekci revised this gist
Dec 28, 2023 . No changes.There are no files selected for viewing
-
hkulekci revised this gist
Dec 27, 2023 . 2 changed files with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,15 +2,19 @@ Create an app through developer platform : ``` https://<your-account>.app.box.com/developers/console ``` Then later, get the service account email from the general settings : ``` AutomationUser_0000000_xxxxxxx@boxdevedition.com ``` Share the folders with this service account. And run the script as : ``` mkdir backup python download.py <folder-id> ``` File renamed without changes. -
hkulekci revised this gist
Dec 27, 2023 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,15 @@ ## Usage Create an app through developer platform : https://<your-account>.app.box.com/developers/console Then later, get the service account email from the general settings : AutomationUser_0000000_xxxxxxx@boxdevedition.com Share the folders with this service account. And run the script as : ``` mkdir backup python download_folder.py <folder-id> -
hkulekci created this gist
Dec 27, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ ## Usage ``` mkdir backup python download_folder.py <folder-id> ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ import os from boxsdk import Client, OAuth2 import sys auth = OAuth2( client_id='client-id', client_secret='', access_token='primary-access-token' ) client = Client(auth) service_account = client.user().get() print(f'Service Account user ID is {service_account.id}') print(service_account) folder = client.folder(sys.argv[1]) print(folder.get().name) def recursively_download(folder, path=None): os.makedirs(path, exist_ok=True) for item in folder.get_items(): print(f"{item.name} - {item.type}") if item.type == 'folder': recursively_download(item, f"{path}/{item.name}") elif item.type == 'file': output_file = open(f"{path}/{item.name}", 'wb') item.download_to(output_file) recursively_download(folder, f"backup/{folder.get().name}")