嗨我想获取最后修改日期和时间的文件,它存储在我的本地设备内存目录。有可能在文件系统中获得lastmodifieddate吗?如何在Filesystem中获取上次修改的日期和时间?
到现在我一直在试图与下面的代码
function checkLastModifiedDate(){
window.resolveLocalFileSystemURL(cordova.file.
externalRootDirectory
+"Download/SMU/File Repo/SMUDE_Connect_User_Guide.pdf",
function(fs) {
LastModifiedDateOfFile(fs);
}, failFiles);
function failFiles(error) {
if (error.code == FileError.NOT_FOUND_ERR)
toastr.error('User guide manual not exists.', 'Information')
else if (error.code == FileError.SECURITY_ERR)
console.log("Message : SECURITY_ERR")
else if (error.code == FileError.ABORT_ERR)
console.log("Message : ABORT_ERR")
else if (error.code == FileError.NOT_READABLE_ERR)
console.log("Message : NOT_READABLE_ERR")
else if (error.code == FileError.ENCODING_ERR)
console.log("Message : ENCODING_ERR")
else if (error.code == FileError.NO_MODIFICATION_ALLOWED_ERR)
console.log("Message : NO_MODIFICATION_ALLOWED_ERR")
else if (error.code == FileError.INVALID_STATE_ERR)
console.log("Message : INVALID_STATE_ERR")
else if (error.code == FileError.SYNTAX_ERR)
console.log("Message : SYNTAX_ERR")
else if (error.code == FileError.INVALID_MODIFICATION_ERR)
console.log("Message : INVALID_MODIFICATION_ERR")
else if (error.code == FileError.QUOTA_EXCEEDED_ERR)
console.log("Message : QUOTA_EXCEEDED_ERR")
else if (error.code == FileError.PATH_EXISTS_ERR)
console.log("Message : PATH_EXISTS_ERR")
}
}
function LastModifiedDateOfFile(fileEntry){
var lastMod = fileEntry.lastModifiedDate;
//alert("lastMod - "+lastMod);
//var date = new Date(fileEntry.lastModified);
//alert("date - "+date);
}
简称链接http://www.html5rocks.com/en/tutorials/file/filesystem/
而这样一来,我们可以做,但我不是通过输入标签 http://jsbin.com/ajepef/1/edit?html,output
每次是选择文件显示'未定义',我不确定lastmodifeddate属性是否存在。 如果有人知道请帮助我。
就像一个魅力的工作。谢谢兄弟.. –