• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Work with files

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
I have a problem to solve, but I am not so good programmer to handle with it without help.
Now I will describe problem in steps:
I have folder with files, each named in style: DateUsername.smth (Date is date in what it is made, but Username is user what made this file)(instead of smth can be "new", "old", "bght"). In folder there are plenty of these files, so, i need to write a code that takes, for example, all files with dateusername.new and rename all this data as DateUsername.txt and collect from all these new .txt files one large file: datetogether.txt
What I need is:
1) I know how to read one file, but I dont know how to read many files and put all stuff in one file from all these files;
2) I dont know hot to sort out files with extension, for example .new;
3) I dont know how to rename each file from .new to .txt;
4) I dont know how to find file just, for example by date, because for each file is different user, but date the same...
I will be very grateful for every helpful post!!!
[ November 02, 2006: Message edited by: Andrejs Joziks ]
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most of what you want to do with locating files by name or extension and renaming them will have to be done with the java.io.File class. I suggest that you start work there, read the JavaDocs for the File class and experiment with the methods.
Put off the combining until you have mastered the use of File.

Bill
 
Andrejs Joziks
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, thank you!!!
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic