Designed by Veethemes.com

How to Set manually Auto-Expiry Dates for Shared Folders in Google Drive

       When you share a folder or a file in Google Drive with anyone, the shared links will stay active forever until you manually change the access permissions. There isn’t a way to set an expiration date for your shared files or folders that will make these links unavailable after a certain date and time.

You can however add an auto-expire feature to any of your shared folders in Google Drive with the help of a simple Google Script.




Set Expiration Dates & Temporarily Share Google Drive Folders

You create a folder in Google Drive and share it with Public or a small group. You then specify a date/time when you want that shared link to expire. The script, at the specified time, will create a copy of your shared folder and delete the original one. Thus the shared links would no longer work though the folder and files will stay in your Google Drive.

Recommended Reading : Monitor your Website’s Uptime with Google Docs
image source : labnol.org

Let’s get this to work now.
Integrating Google Drive
The first step is to make a copy of this script on Google Script. Click on File > Make A Copy.

Under EXPIRY_TIME put in the date (yyyy-mm-dd) and time the folder ceases to be shared. Under FOLDER_URL, change the url path to the folder you want to set an expiration time to.

The folder URL that needs replacing must be the ‘link to share’ of the folder. To obtain the ‘Link to share’ URL, tick the folder you want to share and click on Share.

After doing so, you’ll see the ‘Sharing Settings’ page. Copy the ‘Link to share’ and replaced it in the script.

After all the changes, your script should look something like this.

Next, click on Run > Initialize.

It will ask for permission to access your data, click on Authorize.
After authorizing permission, click on Run > Start, and your folder now has an expiry date. You will receive this notification in an email. Easy isn’t it?
This script only works on Google Drive folder, so if you want to share a single file but with an expiration date, you need to place the file in its own folder. For now you can only set expiration dates for one folder at a time.
Conclusion :
The Google script can be used for setting expiry dates against shared folders only but not for individual files due to certain limitations in Google Apps Script. Thus, in case you wish to auto-expire an individual file, just put in a new folder and share that entire folder.

Content source : [labnol.org & hongkiat.com] 

0 comments:

Post a Comment