Frage

I have a bunch of video files with names like so:

6592110904-Ivory-2.mp4
6592280588-Cornflower.mp4
6592321696-Ballet Pink.mp4

I want to rename them to get rid of everything after the first hyphen so they end up like:

6592110904.mp4
6592280588.mp4
6592321696.mp4

How do I go about doing this?

War es hilfreich?

Lösung

Please put the code below in a bat file, place it in directory with mp4 files. Before running real renaming, please remove "echo" before "move". please be carefull with renaming bacause (theoretically) it is possible to have same name for different files.You'll be prompted to confirm if you want to override the old one.

Code splits each filename after dash and renames the file taking first item. Good luck.

@echo off

for /F "tokens=1,* delims=-" %%a in ('dir /A-D /B "*.mp4"') do (
    echo move "%%a-%%b" "%%a%%~xb"
)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top