5

If FileID follows a particular format like new file has higher values or lower values I can keep track of the old values and find out whether I hace uploaded a new File in drive.

Manikandan
  • 85
  • 2
  • 9

2 Answers2

9

The format is a 264 bit number

bit 0   5 6             261 261 263
+--------+-----------------+-------+
| 110101 | 256 RANDOM BITS | 00    |
+--------+-----------------+-------+

url safe base64 encoded as

/1[a-zA-Z0-9_-]{42}[AEIMQUYcgkosw048]/

You can store just the random part as a Byte[32] but it is safer to treat it as a random string as this may change at any time

Aaron Goldman
  • 829
  • 9
  • 7
  • Any ideas what that 110101 or 00 at the end are about? – Safa Alai Jul 06 '20 at 21:04
  • @SafaAlai the `110101` is so that all drive ids start with "1" when encoded as base64, because [base64](https://en.wikipedia.org/wiki/Base64) encodes 6 bits at a time and it encodes `110101` as "1". This is (probably) done so that you can tell at a glance that some base64 sequence you're looking at is definitely not a drive id if it doesn't start with "1". – Boris Verkhovskiy Jan 07 '21 at 11:41
  • Most likely the "1" at the beginning is intended as a version number to enable new future formats that will not be confused with the current format. – Aaron Goldman Jan 09 '21 at 05:46
0

File ID is just a random string - there is no format.

You are taking the wrong approach. Look at the changes resource https://developers.google.com/drive/v3/reference/changes

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
  • So how Do I find the new files added to my drive. If there is something for reference it would be very useful do you know any ?? – Manikandan Nov 07 '17 at 13:33
  • Suppose if I am having an app which user needs to be notified when new files are added what would you do ?? – Manikandan Nov 07 '17 at 13:34