Mon, Dec 23, 7:59 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: Python script that will remove a folder structure within Runtime...?


DarkEdge ( ) posted Thu, 18 June 2009 at 7:54 PM · edited Sun, 11 August 2024 at 7:40 PM

Is it possible to have a python script that would remove any and all files within a Runtime folder structure?
Like anything withing DarkEdge:Simon:ThisFile

Thanks

Comitted to excellence through art.


nruddock ( ) posted Thu, 18 June 2009 at 8:34 PM

Quote - Is it possible to have a python script that would remove any and all files within a Runtime folder structure?
Like anything withing DarkEdge:Simon:ThisFile

Is there a particular reason why you want a script for this ?
As it seems likely that you'd have to browse to the directory you cleared, why not just delete it via Explorer.
If you just want to be able to delete a directory tree by specifying a (full or relative to some location) path, then a simple BAT file would seem more appropriate.


DarkEdge ( ) posted Thu, 18 June 2009 at 8:45 PM

Okay, sounds great.
I have no idea what you are talking about.
Can you assist me further?

Comitted to excellence through art.


markschum ( ) posted Thu, 18 June 2009 at 10:31 PM

Yes it is possible using python. If you can specify exactly what gets deleted.  

The python command is a combination of walk , which lists a directory tree but you have to do deletes from the bottom up if you are deleting folders too. Its also not something you can get wrong , a mistake is very very bad .

If its just files though you can also do that from the cmd prompt using the old commands like dir  and kill. 

 


DarkEdge ( ) posted Thu, 18 June 2009 at 10:41 PM

Well, I wanted to delete some files within the Runtime structure, they would be specifically within my own folders within that structure though. Understand?

Could that be done without botching the rest of the Runtime folders/files?

Example: Runtime:Geometries:DarkEdge:Simon:ThisFolder:ThisFile.obj

Comitted to excellence through art.


markschum ( ) posted Fri, 19 June 2009 at 1:35 AM

If you wanted to delete all contents of say "Simon" folder  and everything below it in the tree that can be done by script. It would be almost as fast to use windows explorer and do it manually unless you need to do it very often , like a test installation. 

The script would need to specify an exact file or folder name to delete .


adp001 ( ) posted Fri, 19 June 2009 at 6:31 AM

Quote -
The python command is a combination of walk , which lists a directory tree but you have to do deletes from the bottom up if you are deleting folders too. Its also not something you can get wrong , a mistake is very very bad .

Sorry, no. You need just:
**
import os
os.removedirs()**

This will delete the path and files/subdirectories in the path.




Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.