daha önce benzer bir ihtiyacım olmuştu ve go dilini kullanarak şöyle bir çözüm üretmiştim; işine yarar umarım. python da kullanılabilir hatta muhtemelen daha basit olur
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
func main() {
folderPath := "galiyevklasor" // Enter the folder path here
files, err := ioutil.ReadDir(folderPath)
if err != nil {
fmt.Println("Error reading directory:", err)
return
}
for _, file := range files {
if !file.IsDir() {
oldFilePath := filepath.Join(folderPath, file.Name())
fileExt := filepath.Ext(file.Name())
fileBase := strings.TrimSuffix(file.Name(), fileExt)
newFileName := fmt.Sprintf("%s_%s%s", folderPath, fileBase, fileExt)
newFilePath := filepath.Join(folderPath, newFileName)
err := os.Rename(oldFilePath, newFilePath)
if err != nil {
fmt.Printf("Error renaming file %s: %v\n", file.Name(), err)
continue
}
}
}
fmt.Println("File names changed!")
}