diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/.idea/artifacts/createWorkFolder.xml b/.idea/artifacts/createWorkFolder.xml
deleted file mode 100644
index c11467c..0000000
--- a/.idea/artifacts/createWorkFolder.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- $PROJECT_DIR$/out/artifacts/createWorkFolder
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/artifacts/createWorkFolder_jar.xml b/.idea/artifacts/createWorkFolder_jar.xml
new file mode 100644
index 0000000..f4fc215
--- /dev/null
+++ b/.idea/artifacts/createWorkFolder_jar.xml
@@ -0,0 +1,10 @@
+
+
+ $PROJECT_DIR$/out/artifacts/createWorkFolder_jar
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/artifacts/create_folder_jar.xml b/.idea/artifacts/create_folder_jar.xml
new file mode 100644
index 0000000..4bf4fa4
--- /dev/null
+++ b/.idea/artifacts/create_folder_jar.xml
@@ -0,0 +1,8 @@
+
+
+ $PROJECT_DIR$/out/artifacts/create_folder_jar
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..aa00ffa
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 8d66637..c733ec1 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -1,5 +1,8 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 07115cd..82dbec8 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,13 @@
+
+
+
+
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 8178fcc..ca706df 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -1,3 +1,3 @@
Manifest-Version: 1.0
-Main-Class: CreateWorkFolder
+Main-Class: src.CreateWorkFolder
diff --git a/out/artifacts/createWorkFolder_jar/create_workfolder.jar b/out/artifacts/createWorkFolder_jar/create_workfolder.jar
new file mode 100644
index 0000000..ed887f4
Binary files /dev/null and b/out/artifacts/createWorkFolder_jar/create_workfolder.jar differ
diff --git a/out/artifacts/create_folder_jar/create_folder.jar b/out/artifacts/create_folder_jar/create_folder.jar
new file mode 100644
index 0000000..c9c5d79
Binary files /dev/null and b/out/artifacts/create_folder_jar/create_folder.jar differ
diff --git a/out/artifacts/create_workfolder_jar/create_workfolder.jar b/out/artifacts/create_workfolder_jar/create_workfolder.jar
new file mode 100644
index 0000000..fc14ab0
Binary files /dev/null and b/out/artifacts/create_workfolder_jar/create_workfolder.jar differ
diff --git a/out/production/create_workfolder/.idea/.gitignore b/out/production/create_workfolder/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/out/production/create_workfolder/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/out/production/create_workfolder/.idea/artifacts/createWorkFolder_jar.xml b/out/production/create_workfolder/.idea/artifacts/createWorkFolder_jar.xml
new file mode 100644
index 0000000..7863538
--- /dev/null
+++ b/out/production/create_workfolder/.idea/artifacts/createWorkFolder_jar.xml
@@ -0,0 +1,10 @@
+
+
+ $PROJECT_DIR$/out/artifacts/createWorkFolder_jar
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/create_workfolder/.idea/inspectionProfiles/Project_Default.xml b/out/production/create_workfolder/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..8d66637
--- /dev/null
+++ b/out/production/create_workfolder/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/create_workfolder/.idea/libraries/create_workfolder.xml b/out/production/create_workfolder/.idea/libraries/create_workfolder.xml
new file mode 100644
index 0000000..c90c6ad
--- /dev/null
+++ b/out/production/create_workfolder/.idea/libraries/create_workfolder.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/create_workfolder/.idea/misc.xml b/out/production/create_workfolder/.idea/misc.xml
new file mode 100644
index 0000000..07115cd
--- /dev/null
+++ b/out/production/create_workfolder/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/out/production/create_workfolder/.idea/modules.xml
similarity index 100%
rename from .idea/modules.xml
rename to out/production/create_workfolder/.idea/modules.xml
diff --git a/out/production/create_workfolder/.idea/vcs.xml b/out/production/create_workfolder/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/out/production/create_workfolder/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/create_workfolder/META-INF/MANIFEST.MF b/out/production/create_workfolder/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..8178fcc
--- /dev/null
+++ b/out/production/create_workfolder/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: CreateWorkFolder
+
diff --git a/fastConvertMPG2mp4.bat b/out/production/create_workfolder/fastConvertMPG2mp4.bat
similarity index 100%
rename from fastConvertMPG2mp4.bat
rename to out/production/create_workfolder/fastConvertMPG2mp4.bat
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..66d62ec
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,32 @@
+
+
+ 4.0.0
+
+ org.example
+ create_folder
+ 1.0
+
+
+ 17
+ 17
+ UTF-8
+
+
+
+
+ maven-jar-plugin
+ 3.3.0
+
+
+
+ true
+ org.example.Main
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CreateWorkFolder.java b/src/CreateWorkFolder.java
similarity index 91%
rename from CreateWorkFolder.java
rename to src/CreateWorkFolder.java
index 0f7cc7b..84a9c5e 100644
--- a/CreateWorkFolder.java
+++ b/src/CreateWorkFolder.java
@@ -1,10 +1,10 @@
-import java.io.File;
+package src;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
@@ -14,10 +14,10 @@ public class CreateWorkFolder {
public static void main(String[] args) {
// 获取今天的日期,并将其格式化为 "yyyy-MM-dd" 的字符串
LocalDate today = LocalDate.now();
- String dateStr = today.format(DateTimeFormatter.ofPattern("M-d"));
+ String dateStr = today.format(DateTimeFormatter.ofPattern("M.d"));
// 创建今天日期的目录
- Path dirPath = Paths.get("X:\\" + dateStr);
+ Path dirPath = Paths.get("D:\\" + dateStr);
createFolder(dirPath);
// 在目录下创建三个子目录
@@ -41,8 +41,8 @@ public class CreateWorkFolder {
}
// 在video目录下创建一个转换视频文件
- Path sourcePath = Paths.get("fastConvertMPG2mp4.bat");
- Path videoConvertFile = Paths.get(dirPath.toString()+"\\video").resolve("fastConvertMPG2mp4.bat");
+ Path sourcePath = Paths.get("src/fastConvertMPG2mp4.bat");
+ Path videoConvertFile = Paths.get(dirPath.toString()+"\\video").resolve("src/fastConvertMPG2mp4.bat");
if (Files.exists(videoConvertFile)) {
System.out.println("File already exists2: " + videoConvertFile);
diff --git a/create_workfolder.iml b/src/create_workfolder.iml
similarity index 100%
rename from create_workfolder.iml
rename to src/create_workfolder.iml
diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java
new file mode 100644
index 0000000..50a2670
--- /dev/null
+++ b/src/main/java/org/example/Main.java
@@ -0,0 +1,78 @@
+package org.example;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @author lwy
+ */
+public class Main {
+ public static void main(String[] args) {
+ // 获取今天的日期,并将其格式化为 "yyyy-MM-dd" 的字符串
+ LocalDate today = LocalDate.now();
+ String dateStr = today.format(DateTimeFormatter.ofPattern("M.d"));
+
+ // 创建今天日期的目录
+ Path dirPath = Paths.get("X:\\" + dateStr);
+ createFolder(dirPath);
+
+ // 在目录下创建三个子目录
+ String[] dirs = {"pic", "pic - 副本", "video", "修改后"};
+ for (String subdir : dirs) {
+ Path subdirPath = Paths.get(dirPath.toString(), subdir);
+ createFolder(subdirPath);
+ }
+
+ // 在目录下创建一个以今天日期命名的txt文件
+ Path filePath = Paths.get(dirPath.toString(), dateStr + ".txt");
+ if (Files.exists(filePath)) {
+ System.out.println("File already exists: " + filePath);
+ } else {
+ try {
+ Files.createFile(filePath);
+ System.out.println("File created: " + filePath);
+ } catch (IOException e) {
+ System.out.println("Failed to create file: " + e.getMessage());
+ }
+ }
+
+ // 在video目录下创建一个转换视频文件
+ InputStream inputStream = Main.class.getClassLoader().getResourceAsStream("fastConvertMPG2mp4.bat");
+ Path videoConvertFile = Paths.get(dirPath + "\\video").resolve("fastConvertMPG2mp4.bat");
+
+ if (Files.exists(videoConvertFile)) {
+ System.out.println("File already exists: " + videoConvertFile);
+ } else {
+ try {
+ if (inputStream != null) {
+ Files.copy(inputStream, videoConvertFile, StandardCopyOption.REPLACE_EXISTING);
+ }
+// Files.copy(sourcePath, videoConvertFile);
+ System.out.println("File created: " + videoConvertFile);
+ } catch (IOException e) {
+ System.out.println("Failed to create file: " + e.getMessage());
+ }
+ }
+
+ System.out.println("文件夹和文件创建结束!!!");
+ }
+
+ static void createFolder(Path subdirPath) {
+ if (Files.exists(subdirPath)) {
+ System.out.println("Directory already exists: " + subdirPath);
+ } else {
+ try {
+ Files.createDirectory(subdirPath);
+ System.out.println("Directory created: " + subdirPath);
+ } catch (IOException e) {
+ System.out.println("Failed to create directory: " + e.getMessage());
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/META-INF/MANIFEST.MF b/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..53851ab
--- /dev/null
+++ b/src/main/resources/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: org.example.Main
+
diff --git a/src/main/resources/fastConvertMPG2mp4.bat b/src/main/resources/fastConvertMPG2mp4.bat
new file mode 100644
index 0000000..bc6c97c
--- /dev/null
+++ b/src/main/resources/fastConvertMPG2mp4.bat
@@ -0,0 +1,10 @@
+@echo off
+chcp 65001
+
+for %%a in (*.mpg) do ffmpeg -hwaccel cuvid -i "%%~a" -c:v h264_nvenc -preset fast -threads 0 "%%~na.mp4"
+
+echo.
+echo 转码已完成 convert success!!!
+echo.
+
+pause
\ No newline at end of file