Cannot rename downloded folder

Come up with a useful post-processing script? Share it here!
Post Reply
kim_1138
Newbie
Newbie
Posts: 3
Joined: February 19th, 2012, 4:47 pm

Cannot rename downloded folder

Post by kim_1138 »

Hi

I have written a c# command line program to do some post download stuff, nothing fancy. One of the things I want to do is rename the folder ,ex "Colombiana 2011 US UNRATED BluRay 1080p DTS x264 CHD" to "Colombiana (6.7, 123min, 1080p)".

This is do with Directory.Move(src, dst) but this throws an exception saying that the folder is used by another process. Is it the sabnzbd process that keeps a lock on the folder when it starts the post processing script?

Regards

/Kim, Sweden
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Cannot rename downloded folder

Post by shypike »

No, SABnzbd doesn't lock the folder.
In fact the "current directory" is below the actual folder.
However, Windows is rather anal-retentive about renaming folders.
If it so much thinks another process uses it, you cannot rename.
We had to add an option to disable SABnzbd own renaming (__unpack__ prefix)
just to work-around this. Windows Home Server is particularly bad with this.
Moving the folder content might be easier to accomplish.
kim_1138
Newbie
Newbie
Posts: 3
Joined: February 19th, 2012, 4:47 pm

Re: Cannot rename downloded folder

Post by kim_1138 »

I thought about moving the content to a new folder with my desired name (like you suggested) but this will leave me with a bunch of orphaned empty directories. Small problem but still, a thorn i my side!, want this script to be 100% unattended.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Cannot rename downloded folder

Post by shypike »

You can add a end-of-queue script to remove all empty folders.
kim_1138
Newbie
Newbie
Posts: 3
Joined: February 19th, 2012, 4:47 pm

Re: Cannot rename downloded folder

Post by kim_1138 »

Nice, didn't know there was such a thing! will look in to that, thanks!
Post Reply