source: lost-perception/utils/FileRename.java

Last change on this file was ebd3538, checked in by Dmitry Portnoy <dmitry.portnoy@…>, 6 years ago

Initial commit. This codebase for the Lost Perception game was created by decompiling code from a jar file.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package utils;
2
3import java.io.File;
4
5public class FileRename {
6 public static void main(final String[] args) {
7 final String path = "D:/workspace/LostHaven2/images/creatures/";
8 final String crName = "orc";
9 final String[] actions = { "attacking", "beenhit", "dying", "walking", "standing" };
10 for (int x = 0; x < actions.length; ++x) {
11 final File dir = new File(String.valueOf(path) + crName + "/" + actions[x]);
12 final File[] contents = dir.listFiles();
13 File[] array;
14 for (int length = (array = contents).length, i = 0; i < length; ++i) {
15 final File curFile = array[i];
16 final String curName = curFile.getName();
17 String newName;
18 if (actions[x].equals("standing")) {
19 newName = curName.substring(curName.indexOf("00"));
20 }
21 else {
22 newName = curName.substring(curName.lastIndexOf(" ") + 1);
23 }
24 curFile.renameTo(new File(String.valueOf(path) + crName + "/" + actions[x] + "/" + newName));
25 curFile.delete();
26 }
27 }
28 }
29}
Note: See TracBrowser for help on using the repository browser.