Post script deleting SABnzbd folder

Come up with a useful post-processing script? Share it here!
Post Reply
causalloop
Newbie
Newbie
Posts: 25
Joined: September 25th, 2012, 6:51 pm

Post script deleting SABnzbd folder

Post by causalloop »

I firstly admit to being a n00b and having cobbled most of this script together from other things I found.

I keep my TV shows on C:\TV Shows and Movies on E:\Movies. Sab's categories and sorting appear to be correct - so I THINK its not a Sab problem.. I use a batch file to flatten the downloaded movie/tvshow into its on directory and then delete the empty folders and then send an update to xbmc (though this part doesn't work quite as well as I hoped - but thats a secondary issue)

The purpose is to end up with flat, clean folders that are easy to read and navigate. Here's the code:

Code: Select all

@ECHO off
ECHO.
ECHO 1: %1
ECHO 2: %2
ECHO 3: %3
ECHO 4: %4
ECHO 5: %5
ECHO 6: %6
ECHO 7: %7
ECHO 8: %8
IF %7==0 FOR /R %1 %%f IN (*) DO @MOVE /Y "%%f" %1 & ECHO Flattening Dirs in %1
IF %7==0 CD %1 & FOR /D %%d IN (*) do @rd /S /Q "%%d" & ECHO Deleting Empty folders in %1
IF %7==0 C:\Python27\pythonw.exe C:\sabstuff\sabscripts\NotifyXBMC.py & ECHO Update to XBMC sent.
EXIT /b 0
This works just fine on TV Shows, but when I download movies, it basically peforms the above script on the Sabnzbd installation directory even though %1 shows the correct path. Here's an example of the output when run on a movie:

Code: Select all

1: "E:\Movies\Serenity (2005)"
2: Serenity.2005.BluRay.1080p.H264-20-40.nzb
3: Serenity.2005.BluRay.1080p.H264-20-40
4: ""
5: movies
6: alt.binaries.cores
7: 0
8: 
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
        1 file(s) moved.
Flattening Dirs.
Deleting Empty folders
Deleting Empty folders
Deleting Empty folders
lib\Cheetah._namemapper.pyd - Access is denied.
lib\LIBEAY32.dll - Access is denied.
lib\OpenSSL.crypto.pyd - Access is denied.
lib\OpenSSL.rand.pyd - Access is denied.
lib\OpenSSL.SSL.pyd - Access is denied.
lib\pyexpat.pyd - Access is denied.
lib\pywintypes25.dll - Access is denied.
lib\select.pyd - Access is denied.
lib\servicemanager.pyd - Access is denied.
lib\sqlite3.dll - Access is denied.
lib\SSLEAY32.dll - Access is denied.
lib\win32api.pyd - Access is denied.
lib\win32event.pyd - Access is denied.
lib\win32evtlog.pyd - Access is denied.
lib\win32file.pyd - Access is denied.
lib\win32gui.pyd - Access is denied.
lib\win32pipe.pyd - Access is denied.
lib\win32process.pyd - Access is denied.
lib\win32service.pyd - Access is denied.
lib\winxpgui.pyd - Access is denied.
lib\_ctypes.pyd - Access is denied.
lib\_hashlib.pyd - Access is denied.
lib\_socket.pyd - Access is denied.
lib\_sqlite3.pyd - Access is denied.
lib\_ssl.pyd - Access is denied.
lib\_yenc.pyd - Access is denied.
Deleting Empty folders
Deleting Empty folders
Deleting Empty folders
Deleting Empty folders
C:\Python27\pythonw.exe: can't open file 'C:\sabscripts\NotifyXBMC.py': [Errno 2] No such file or directory
Update to XBMC sent. (I fixed this one - was just a bad path)
I'm sure its something stupid simple... right now I have it not running this script on movies so I don't have to keep running into this, but it would be nice to get an idea of whats going on.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Post script deleting SABnzbd folder

Post by shypike »

The CD command doesn't allow drive switching.
You must use CD /d instead.
So:
CD /d %1
causalloop
Newbie
Newbie
Posts: 25
Joined: September 25th, 2012, 6:51 pm

Re: Post script deleting SABnzbd folder

Post by causalloop »

Faceplam... Thanks, I'll give that a go :)
Post Reply