Skip to content

Anyone Still thereeee? This seems deserted.... #4

@YTMrSnipa

Description

@YTMrSnipa

Hey! I was trying to uh upload a file via rclone/python...

My code:

import os
import zipfile
import datetime
import rclone
import time
import logging

logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s %(name)s [%(levelname)s]: %(message)s")

cfg = """[local]
type = local
nounc = true"""
result = rclone.with_config(cfg).listremotes()




print("Starting compression...")
def zipdir(path, ziph):
    # ziph is zipfile handle
    for root, dirs, files in os.walk(path):
        for file in files:
            ziph.write(os.path.join(root, file), os.path.relpath(os.path.join(root, file), os.path.join(path, '..')))
  
zipf = zipfile.ZipFile(r"G:/forge_server/world_autoBackup.zip", 'w', zipfile.ZIP_DEFLATED) 
zipdir(r'G:/forge_server/mods', zipf)    # ^^ name of what the file will be outputted as
zipf.close()   #^^ PATH TO BACKUP !! CHANGE ME !!

print("Successfully compressed!")

print("Renaming...")

Current_Date = datetime.datetime.today().strftime ('%d-%b-%Y')
#os.rename(r'G:/forge_server/world_autoBackup.zip',r'G:/forge_server/world_autoBackup ' + str(Current_Date) + '.zip')

time.sleep(5)

print("Uploading to google drive via rclone...")

#cfg = """[local]
#type = local
#nounc = true"""
#result = rclone.with_config(cfg).run_cmd(command="copy", extra_args=["G:/forge_server/world_autoBackup.zip", "backup_drive:forge-server-backups"])

print("Finished Upload!")

Its giving me the error:
2021-02-27 01:58:19,689 RClone [DEBUG]: rclone config: ~[local] type = local nounc = true~ 2021-02-27 01:58:19,694 RClone [DEBUG]: Invoking : rclone listremotes --config C:\Users\Krish\AppData\Local\Temp\tmpf3pwwzzw 2021-02-27 01:58:19,887 RClone [DEBUG]: b'' 2021-02-27 01:58:19,942 RClone [WARNING]: 2021/02/27 01:58:19 Failed to load config file "C:\\Users\\Krish\\AppData\\Local\\Temp\\tmpf3pwwzzw": open C:\Users\Krish\AppData\Local\Temp\tmpf3pwwzzw: The process cannot access the file because it is being used by another process.

Any idea how to fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions