now detects existing files
This commit is contained in:
parent
e433c4b048
commit
93b4258dd5
18
main.go
18
main.go
@ -64,6 +64,24 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
files, err := os.ReadDir(uploadFolder)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(files) != 0 {
|
||||||
|
for _, file := range files {
|
||||||
|
if file.IsDir() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = dbpool.Exec(context.Background(), "insert into videos(filepath) values($1)", fmt.Sprintf("%s/%s", uploadFolder, file.Name()))
|
||||||
|
if err != nil {
|
||||||
|
log.Panicf("main: %v\n", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
router.SetTrustedProxies(nil)
|
router.SetTrustedProxies(nil)
|
||||||
|
|
||||||
|
44211
upload/sys.tree
Normal file
44211
upload/sys.tree
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user