Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #38307
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: I need to get files with different timespan 1hr, 1day.1 week |
| Date | 2018-05-31 07:47 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <peond1$3ai$1@dont-email.me> (permalink) |
| References | <a8a31edc-333e-48fd-a7e0-34f38c9e0d5d@googlegroups.com> |
On 5/31/2018 6:07 AM, siddareddy.moolam@gmail.com wrote:
> i have a folder with different files with different dates i need to get if one hour file is there or not,need to display file name
> after that 1 day file need to displayed
>
> after 1 week file name should be displayed ..
> Ex:
>
> 31-05-2018 folder inside filename is like these : 31-05-2018_10-42-25_rakesh_hike_load_608_output.txt if i need to enter 1 day details i need to display that file
What difficulty are you having? Here are a few hints
about possible solution steps:
- To inspect the names of files and folders contained in
another folder, start with a File object representing the
container and use its list() or listFiles() method:
File folder = new File("C:\\Users\\siddareddy\\folder");
for (String name : folder.list())
System.out.println(name);
// ... or ...
for (File child : folder.listFiles())
System.out.println(child);
- To convert the first part of a file name to a time stamp
(so you can easily compare it to "Yesterday" or "Last week"),
first separate the date-and-time portion from the rest:
String name
= "31-05-2018_10-42-25_rakesh_hike_load_608_output.txt";
String prefix = "31-05-2018_10-42-25";
... then use a SimpleDateFormat to parse the prefix:
DateFormat format = new SimpleDateFormat("dd-MM-yy_HH-mm-ss");
Date stamp = format.parse(prefix);
If this doesn't help you get started, please tell us more about
the problems you are facing.
--
esosman@comcast-dot-net.invalid
Nine hundred sixty-five days to go.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I need to get files with different timespan 1hr, 1day.1 week siddareddy.moolam@gmail.com - 2018-05-31 03:07 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-31 07:47 -0400
Re: I need to get files with different timespan 1hr, 1day.1 week siddareddy.moolam@gmail.com - 2018-05-31 05:59 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week Eric Douglas <e.d.programmer@gmail.com> - 2018-05-31 06:52 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-05-31 15:53 +0200
Re: I need to get files with different timespan 1hr, 1day.1 week Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-05-31 10:08 -0400
Re: I need to get files with different timespan 1hr, 1day.1 week msr2858@gmail.com - 2018-05-31 22:02 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week msr2858@gmail.com - 2018-05-31 22:08 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week Eric Sosman <esosman@comcast-dot-net.invalid> - 2018-06-01 07:43 -0400
Re: I need to get files with different timespan 1hr, 1day.1 week msr2858@gmail.com - 2018-06-01 04:57 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week msr2858@gmail.com - 2018-06-01 04:58 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week msr2858@gmail.com - 2018-06-01 05:00 -0700
Re: I need to get files with different timespan 1hr, 1day.1 week Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2018-06-01 16:08 +0200
csiph-web