How to find the files being written between a time range in java in unix -


i have several files in directory , want find files written between time range. know not possible create time of file in linux.

i can work out sorting files last modified time , there simpler way ?

in case mean implicitly java solution:

in java, can use file.lastmodified() file’s last modified timestamps. method returns time in milliseconds (long value, epoch time), may format simpledateformat make human readable format.

so need this:

file folder = new file("your/path"); file[] listoffiles = folder.listfiles();  (int = 0; < listoffiles.length; i++) {     if (listoffiles[i].isfile()) {         if(listoffiles[i].lastmodified() > && listoffiles[i].lastmodified() < to){                 dosomething();         }     } } 

note: from,to of type long , represent time stamp.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -