Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
common
Commits
bb791662
Commit
bb791662
authored
Oct 14, 2020
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 删除指定后缀文件
parent
637e5fec
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
145 deletions
+156
-145
FileUtil.java
src/main/java/com/egolm/common/FileUtil.java
+10
-0
ZipUtil.java
src/main/java/com/egolm/common/ZipUtil.java
+146
-145
No files found.
src/main/java/com/egolm/common/FileUtil.java
View file @
bb791662
...
@@ -378,6 +378,16 @@ public class FileUtil {
...
@@ -378,6 +378,16 @@ public class FileUtil {
}
}
}
}
public
static
void
fileDeleteBySuffix
(
String
filePath
,
String
suffix
)
{
File
file
=
new
File
(
filePath
);
File
[]
files
=
file
.
listFiles
();
for
(
File
f:
files
)
{
if
(
f
.
getName
().
endsWith
(
suffix
))
{
f
.
delete
();
}
}
}
public
static
byte
[]
streamToBytes
(
InputStream
instream
)
{
public
static
byte
[]
streamToBytes
(
InputStream
instream
)
{
byte
[]
bytes
=
null
;
byte
[]
bytes
=
null
;
ByteArrayOutputStream
baos
=
null
;
ByteArrayOutputStream
baos
=
null
;
...
...
src/main/java/com/egolm/common/ZipUtil.java
View file @
bb791662
...
@@ -138,9 +138,10 @@ public final class ZipUtil {
...
@@ -138,9 +138,10 @@ public final class ZipUtil {
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
String
targetPath
=
"D:\\
Green\\IDC\\50010"
;
String
targetPath
=
"D:\\
data\\erp\\91310114594794273Y"
;
File
file
=
ZipUtil
.
zip
(
targetPath
);
File
file
=
ZipUtil
.
zip
(
targetPath
);
ZipUtil
.
unzip
(
file
,
"D:\\IDC"
);
System
.
out
.
println
(
file
.
getName
());
//ZipUtil.unzip(file, "D:\\data\\erp\\91310114594794273Y");
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment