如何设置文件创建日期?

时间:2017-11-19 07:24:12

标签: java android

我编写了一个将数据从一个目录复制到另一个目录的应用程序。 问题是: 它不保留文件创建日期并设置为当前日期和时间。 我使用apache库:

FileUtils.copyFile(item, dest, true);

如何在Android上设置文件创建日期/时间?

1 个答案:

答案 0 :(得分:0)

您可以通过设置上次修改日期来设置日期。

library(tidyverse)
df %>%
  arrange(comp_id, desc(value)) %>% #arrange by comp_id and descending value 
  mutate(ord = 1:n()) -> dat #create the x scale

ggplot(dat, aes(x = ord, y = value , group = comp_id , colour = comp_id))+
  geom_line()+
  facet_wrap(~comp_id, ncol = 1, scales = "free_x", drop = TRUE)+
  theme(axis.text.x=element_text(angle=35, vjust=1,  hjust=1)) +
  scale_x_continuous(labels = dat$predictor, breaks = dat$ord, expand = c(0.02, 0.02))

您可以参考https://developer.android.com/reference/java/io/File.html#setLastModified(long) 了解更多详情。