• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Work with files

 
Andrejs Joziks
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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 ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Ok, thank you!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic