FileUtils.java
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package isa.qa.utils;
import java.io.File;
/**
* File utils
*
* @author May
* @date 2018/12/28 16:00
* @version 1.0
*/
public class FileUtils {
/**
* File suffix separator
*/
private static final String FILE_SUFFIX_SEPARATOR = ".";
/**
* Get file suffix
*
* @param fileName file name
* @return file suffix
*/
public static String getFileSuffix(String fileName) {
return fileName.substring(fileName.lastIndexOf("."));
}
/**
* Make directory
*
* @param dirPath dir's path
* @return mkdir result
*/
public static boolean mkdir(String dirPath) {
File file = new File(dirPath);
if (!file.exists()) {
return file.mkdirs();
}
return true;
}
/**
* Delete the file
*
* @param filePath file's path
* @return delete file result
*/
public static boolean delFile(String filePath) {
File file = new File(filePath);
if (file.exists()) {
return file.delete();
}
return true;
}
}