Update batch function & data

This commit is contained in:
2023-06-01 09:46:32 +09:00
parent fbf0cccfc8
commit 7bf087b3ed
3 changed files with 12 additions and 6 deletions

View File

@@ -8,5 +8,3 @@
import Foundation
KissConsole().run()
//move_candles_to_min_subdir()

View File

@@ -161,7 +161,10 @@ private func check_candle_csv() {
}
func move_candles_to_min_subdir() {
private func move_candles_to_min_subdir() {
// Move all of csv into min sub-directory
// ex) data/000020/candle-20230530.csv --> /data/000020/min/candle-20230530.csv
//
guard let enumerator = subPathFiles("data") else {
return
}
@@ -177,13 +180,18 @@ func move_candles_to_min_subdir() {
for fileUrl in urls {
let fileName = fileUrl.lastPathComponent
let upper = fileUrl.deletingLastPathComponent()
let productNo = upper.lastPathComponent
guard let _ = Int(productNo) else {
continue
}
let newPath = upper.appending(path: "min")
let newUrl = newPath.appending(path: fileName)
//print("file: \(fileUrl) -> \(newUrl)")
do {
try FileManager.default.createDirectory(at: upper, withIntermediateDirectories: true)
try FileManager.default.createDirectory(at: newPath, withIntermediateDirectories: true)
try FileManager.default.moveItem(at: fileUrl, to: newUrl)
}
catch {