I'm trying to work around DirectUnpack creating the sub-folder called "_unpack" while it's unpacking the file to "completed / NZB NAME / _unpack"
I've tested manually moving the unpacked file while it's still writing, and it continues to write. I presume it's possible to write a script that just moves the continuously writing file a directory above. I need the file in "completed / NZB NAME".
Thanks for any help.
Code: Select all
#!/usr/bin/env python ### NZBGET SCAN SCRIPT import os.path import time import shutil foldername=os.path.splitext(NZBNP_NZBNAME) folder="/downloads/completed/" + foldername while not os.path.exists(folder): time.sleep(1) while not os.path.exists(folder + "/_unpack/"): time.sleep(1) while not len(os.listdir(folder + "/_unpack/") ) == 0: time.sleep(1) files = os.listdir(folder + "/_unpack") for f in files: shutil.move(folder + "/_unpack/" + f, folder)