aspose file tools*
The moose likes Java in General and the fly likes Work with files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Work with files" Watch "Work with files" New topic
Author

Work with files

Andrejs Joziks
Greenhorn

Joined: Nov 02, 2006
Posts: 4
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 ]

Stay cool!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12803
    
    5
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

Joined: Nov 02, 2006
Posts: 4
Ok, thank you!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Work with files