是否有可能恢复一个Android文件的最后修改日期? [英] Is it possible to reset the last modified date of an Android file?

查看:140
本文介绍了是否有可能恢复一个Android文件的最后修改日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我们的软件,消除尚未一个多月应用于所有的图像文件的清除功能。要做到这一点,我检查两件事情:

I'm writing a purge function for our software that removes all image files that haven't been used in over a month. To do this, I am checking two things:


  1. 文件的最后修改日期

  2. ,显示最近浏览过的文件的数据库上查询。

查询比文件检查要慢得多。所以,我想最好是能够重置失败的第一次检查所有文件的最后修改日期,但通过第二道,这样(例如)的古老的,但经常使用的文件列表不逐步增加处理管理系统的负荷。

The query is much slower than the file check. So I would ideally like to be able to reset the last modified date on any files that fail the first check, but pass the second, so that (for example) a list of venerable but often-used files aren't gradually increasing the processing load of the management system.

有没有办法做到这一点不诉诸原油的东西(甚至可能更慢),就像每个文件重命名为一个临时的标签,然后自己?

Is there a way to do this without recourse to something crude (and possibly even slower), like renaming each file to a temporary label, then itself?

推荐答案

setLastModified()是在任何Java 文件的标准方法对象,您可以用它来更新此值。

setLastModified() is a standard method on any Java File object that you can use to update this value.

SDK文档

这篇关于是否有可能恢复一个Android文件的最后修改日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆