24hnovel
  • HOME
  • NOVEL
  • COMICS
  • COMPLETED
  • RANKINGS
Sign in Sign up
  • HOME
  • NOVEL
  • COMICS
  • COMPLETED
  • RANKINGS
  • Romance
  • Comedy
  • Shoujo
  • Drama
  • School Life
  • Shounen
  • Action
  • MORE
    • Adult
    • Adventure
    • Anime
    • Comic
    • Cooking
    • Doujinshi
    • Ecchi
    • Fantasy
    • Gender Bender
    • Harem
    • Historical
    • Horror
    • Josei
    • Live action
    • Manga
    • Manhua
    • Manhwa
    • Martial Arts
    • Mature
    • Mecha
    • Mystery
    • One shot
    • Psychological
    • Sci-fi
    • Seinen
    • Shoujo Ai
    • Shounen Ai
    • Slice of Life
    • Smut
    • Soft Yaoi
    • Soft Yuri
    • Sports
    • Tragedy
    • Supernatural
    • Webtoon
    • Yaoi
    • Yuri
Sign in Sign up
Prev
Next

What Do You Mean I'm The Captain Of A Yandere Mercenary Company? - Chapter 535

  1. Home
  2. All Mangas
  3. What Do You Mean I'm The Captain Of A Yandere Mercenary Company?
  4. Chapter 535
Prev
Next

# Đường dẫn tới thư mục chứa các thư mục chapter
$sourceDir = “C:UsersADMINDesktopWEBNOVEL” # Thay bằng đường dẫn thư mục chứa các thư mục như “Chapter 274”

# Duyệt qua từng thư mục trong thư mục gốc
Get-ChildItem -Path $sourceDir -Directory | ForEach-Object {
$folder = $_
$txtFiles = Get-ChildItem -Path $folder.FullName -File “*.txt”

if ($txtFiles) {
# Lấy dòng đầu tiên từ file .txt đầu tiên
$firstLine = Get-Content -Path $txtFiles[0].FullName -TotalCount 1
if ($firstLine) {
# Tìm vị trí của hai dấu cách liền nhau
$doubleSpaceIndex = $firstLine.IndexOf(” “)
if ($doubleSpaceIndex -ge 0) {
# Lấy từ đầu đến trước hai dấu cách
$chapterNameExtend = $firstLine.Substring(0, $doubleSpaceIndex).Trim()
} else {
# Nếu không có hai dấu cách, lấy toàn bộ dòng
$chapterNameExtend = $firstLine.Trim()
}

# Loại bỏ ký tự không hợp lệ trong tên thư mục
$chapterNameExtend = $chapterNameExtend -replace ‘[/:*?”<>|]’, ”
# Tạo tên mới: “Chapter X — Chapter Name Extend”
$newFolderName = “$($folder.Name) — $chapterNameExtend”
$newFolderPath = Join-Path -Path $sourceDir -ChildPath $newFolderName

# Đổi tên thư mục
Rename-Item -Path $folder.FullName -NewName $newFolderName
Write-Host “Đã đổi tên: $($folder.Name) -> $newFolderName”
}
} else {
Write-Host “Không tìm thấy file .txt trong: $($folder.Name)”
}
}

Write-Host “Hoàn tất đổi tên các thư mục!”

# (Tùy chọn) Nén thành file ZIP
# $outputZip = “C:pathtooutput.zip”
# Compress-Archive -Path “$sourceDir*” -DestinationPath $outputZip -Force
# Write-Host “Đã tạo file ZIP: $outputZip”

Prev
Next
Tags:
Novel
  • HOME
  • CONTACT US
  • PRIVACY & TERMS OF USE

© 2025 24HNOVEL. Have fun reading.

Sign in

Lost your password?

← Back to 24hnovel

Sign Up

Register For This Site.

Log in | Lost your password?

← Back to 24hnovel

Lost your password?

Please enter your username or email address. You will receive a link to create a new password via email.

← Back to 24hnovel