Google-drive – the the default order of the links returned by “Get sharable links” on Google Drive

google-drivelinkssharing

I read here how to get links of multiple files in Google Drive: Get share link of multiple files in Google Drive to put in spreadsheet. This works but the links which are generated are not following the order of the files which are shared and it is not clear which order they follow.
For example imagine I have ten files in the directory: File1, File2, … File10.
Then I would like the link for File1 as the first, link for File2 as the second etc.
So that when I copy paste the list of links in a column next to the file names it follows the order.
But when I generate the shared links they do not follow this order. The first shared link will for example be for File5, the second for File9.

This seems to be random or is it based on something specific?

I could do this manually by opening them and check to which file the link is related but this is a bit of a drag especially when there are 100+ files in the directory.

How does the file share link process work and is there any way to do this?

Best Answer

This script lists all the files in a folder and gets the metadata for it: https://gist.github.com/mesgarpour/07317e81e9ee2b3f1699 Solved my question... cheers