Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
gaboolic committed Aug 3, 2023
1 parent 9c4a8c5 commit 0c0ffb1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions dealzip.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');

//https://zip.baipiao.eu.org/
function readAllFilenames(directoryPath) {
// 读取目录内容
fs.readdir(directoryPath, (err, files) => {
if (err) {
console.error('读取目录出错: ', err);
return;
}

// 遍历每个文件名并输出
files.forEach((file) => {
const filename = path.basename(file,path.extname(file))
const fileNameWithFullPath = directoryPath+"/"+file;
const country = filename.split("-")[0]
const port = filename.split("-")[2]
const cmd = `~/script/CloudflareST/CloudflareST -f ${fileNameWithFullPath} -o ${filename}.csv -tp ${port}`;
console.log(cmd)

try {
const output = execSync(cmd);
console.log(output.toString()); // 命令的输出
} catch (error) {
console.error(`执行命令时发生错误: ${error}`);
}
});
});
}

// 调用函数读取文件名
readAllFilenames('~/Downloads/txt');

0 comments on commit 0c0ffb1

Please sign in to comment.