JohnDoee / autotorrent2

Cross-seed matching and torrent lifecycle tool
https://johndoee.github.io/autotorrent2/
MIT License
142 stars 10 forks source link

If the folder already exists, just overwrite it #35

Open newadventure079 opened 1 year ago

newadventure079 commented 1 year ago

If the script errors out or there is some other issue and you re-run the script, you will most likely see Folder exists: 1 at the end of the the subsequent runs.

I know the folder exists already because there was an issue with the previous run, so just remove it and run the code again.

Here is the code I've written to just wipe out the dir if it exists so it will be recreated and things will continue normally and the torrent will be added

create_link_path() in utils.py

    try:
        store_path.mkdir(parents=True)
    except FileExistsError:
        #edits
        shutil.rmtree(store_path)
        store_path.mkdir(parents=True)
        #raise FailedToCreateLinkException("Path already exist")
JohnDoee commented 1 year ago

I can make an argument called something like --ignore-existing or something similar. Might also be smart to revert link folder when it fails.