[REQUEST] Moving a file while unpacking

Share your scripts or request scripts with specific features.
Forum rules
Please keep the forum clean - one topic per script. Questions not related to a specific script should be posted in Support forum.
Post Reply
Posts: 1
Joined: 22 Feb 2019, 22:22

[REQUEST] Moving a file while unpacking

Post by Person5729 » 23 Feb 2019, 02:09

I'd appreciate help with a script, I'm a newb so please expect silly errors.

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".

Code: Select all

#!/usr/bin/env python

import os.path
import time
import shutil

folder="/downloads/completed/" + foldername

while not os.path.exists(folder):
while not os.path.exists(folder + "/_unpack/"):
while not len(os.listdir(folder + "/_unpack/") ) == 0:
files = os.listdir(folder + "/_unpack")

for f in files:
    shutil.move(folder + "/_unpack/" + f, folder)
Thanks for any help. :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest