Using DriveApp service, sometimes you want to specify a folder path like /abc/def/ghi and get the folder object of ‘ghi’. With the old DocsList service this was possible, but it doesn’t exist with the Drive service.

Here’s a handy function to do that.

The opposite – starting with a folder and figuring out its path is probably best done recursively

Although if you really wanted to, you could do it like this

Here’s a test going back and forwards between the two a couple of times – will give you the folder name ‘tasks’

For more like this see Google Apps Scripts Snippets
For help and more information join our forum,follow the blog or follow me on Twitter .