I'm trying to get the path of file or folder by its ID.
I know that parents are just like tags but with Google Drive on the pc it's not the case: they are always folder and file in its hierarchical structure.
So I try this code:
function getPath( fileId ) {
path = ""
names = [];
while ( id != '0AN9ZF6qdu2FUUk9PVA' ){ //the right string is the root id
get_metadata( id )
.then( function(response){
if( response.result.parents )
names.push( response.result.name )
id = response.result.parents[0];
})
}
path = names.reverse.join('/');
return path;
}
It doesn't work. Help me please.