简体   繁体   中英

Renaming Log Files Program [Beginner]

I would like to make a simple eclipse/java program which goes through a folder with many log files and renames each log file based on strings of text found inside the log file.

The log files are all text files, but are named .log.

Here is a screenshot of the folder containing the log files:

在此处输入图片说明

Here is a screenshot of an individual log file. In this case, I would like this log file to be renamed "EFT Daily Activity Report," which shows up in each line.

在此处输入图片说明

The problem is I don't know how to go through folders in eclipse/java to access each of the files.

EDIT: Why doesn't this work? Am I missing something with the directory? Sorry, I'm new to local directories in java :)

在此处输入图片说明

您可以查看以下有关File的教程: http : //tutorials.jenkov.com/java-io/file.html如果我正确理解了您的问题,那么最后一个示例应该是您要查找的内容。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM