https://chrome.google.com/webstore/deta ... fgbncgkfinTimestampeder is a simple Chrome extension to prefix a timestamp to your file download names.
This Chrome extension was originally made for my personal use to back up files from my web2py web servers.
Filename format is using ISO 8601 format (2013-04-01T13:01:02) yielding 20130401T130102-Filename
Here is the source code
bg.js
Code: Select all
function appendTimestamp() {
var now = new Date();
year = now.getFullYear();
month = now.getMonth() + 1;
month = (month <10?'0':'') + month;
day = (now.getDate() <10?'0':'') + now.getDate();
hour = (now.getHours() <10?'0':'') + now.getHours();
minutes = (now.getMinutes() <10?'0':'') + now.getMinutes();
seconds = (now.getSeconds() <10?'0':'') + now.getSeconds();
var myDate = year.toString() + month.toString() + day.toString();
var myTime = hour.toString() + minutes.toString() + seconds.toString();
var timestamp = myDate + "T" + myTime;
return timestamp;
}
chrome.downloads.onDeterminingFilename.addListener(function(item, suggest) {
var newFilename = appendTimestamp() + "-" + item.filename;
suggest({filename: newFilename});
});
Code: Select all
{
"manifest_version": 2,
"name": "Timestampeder",
"description": "Prepends a timestamp to your file download names",
"version": "0.7",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"background": {
"scripts": ["bg.js"]
},
"permissions": ["downloads"],
"content_security_policy": "script-src 'self' chrome-extension-resource: 'unsafe-eval'; default-src 'self'"
}