Update batch function & data
This commit is contained in:
@@ -8,5 +8,3 @@
|
||||
import Foundation
|
||||
|
||||
KissConsole().run()
|
||||
|
||||
//move_candles_to_min_subdir()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
2
bin/data
2
bin/data
Submodule bin/data updated: e62d901f86...d102289c45
Reference in New Issue
Block a user