python/postgres query

Spyro Polymiadis spiz at spiz.no-ip.com
Wed May 29 01:03:50 CST 2013


Hi folks,

I have a python file querying a database to return a list of paths with output like:

/path/to/folder
/path/to/folder/subfolder1
/path/to/folder/othersubfolder2
/path/to/folder2
/path/to/folder/subfolder1
/path/to/folder3
/path/to/folder4
…Etc

which is stored in a variable called 'paths'

How is it possible for me to go through the list – and remove all the entries with "subfolders"
And only leave me with the "top level" 'folder' path?

What would be nicer is if there is an option I can add to my select statement in postgres to only return the right folders.

Any ideas welcome :)

Cheers
Spyro


-- 
This message was scanned by ESVA and is believed to be clean. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.linuxsa.org.au/pipermail/linuxsa/attachments/20130528/80779750/attachment.html 


More information about the linuxsa mailing list