Page 1 of 1

Prevent the creation of subfolders

Posted: October 23rd, 2008, 5:48 am
by Lukas
Hey,
this has to be super easy but I can't make it to work, I have been searching the forums, to no avail. I'm running 0.4.4 on Leopard.

This is what I'm looking for:

- A RSS feed downloads MP3 files that meet certain criteria, these files are downloaded to a certain folder, for example ~/documents/mp3, WITHOUT creating subfolders.

- What I have achieved to get the RSS feed (from binsearch.info),  that only downloads mp3 files that meet my criteria (with different filters), and the files go to ~/documents/mp3 (via the Categories option), the problem is that for each file, a subfolder is created under ~/documents/mp3, typically  subfolders are like "~/documents/mp3/1224758127", "~/documents/mp3/1224758125", etc.

Is there a way to prevent these subfolders to be created?

thanks a bunch.

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 5:54 am
by shypike
Run a user script after each job.
You can set it in Config->Switches, more explanation in http://sabnzbd.wikidot.com/user-scripts

Code: Select all

#!/bin/sh
mv "$1/*" "$1/.."
rmdir "$1"

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 6:25 am
by Lukas
shypike wrote: Run a user script after each job.
You can set it in Config->Switches, more explanation in http://sabnzbd.wikidot.com/user-scripts

Code: Select all

#!/bin/sh
mv "$1/*" "$1/.."
rmdir "$1"
Thanks! although there is slight problem with this, I copied the code in a text file, saved it to /Users/lukas/documents/stuff/SCRIPTS/myscript.sh. When executed the files are not moved and I get this error "/Users/lukas/documents/stuff/SCRIPTS/myscript.sh: Permission denied" any ideas?

cheers.
"

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 7:50 am
by rAf
Hi,

You can try to make the script executable :

Code: Select all

chmod +x /Users/lukas/documents/stuff/SCRIPTS/myscript.sh
rAf

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 8:50 am
by Lukas
Thanks rAf!, I made it executable, and the script was executed but with the following error
    mv: rename /Users/lukas/Sites/RSS/1224767277/* to /Users/lukas/Sites/RSS/1224767277/../*: No such file or directory
rmdir: /Users/lukas/Sites/RSS/1224767277: Directory not empty

thanks for any help

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 2:09 pm
by shypike
Sorry, slight mistake:

Code: Select all

#!/bin/sh
mv "$1/"* "$1/.."
rmdir "$1"
The * should be outside the quotes.

Re: Prevent the creation of subfolders

Posted: October 23rd, 2008, 2:42 pm
by Lukas
it works! thanks shypike!