Skip to main content
Share Your Experience: Take the 2024 Developer Survey
41 votes

Add .mp3 to the end of file names

I often use a command in Command Prompt in Windows, it's REN. The purpose is to rename a file or more. ren oldfile.png newfile.png But in this case, you need to rename multiple files, then we can ...
Kaplan Kim's user avatar
32 votes

Add .mp3 to the end of file names

Just run ren * *.mp3 in cmd. You don't need 3rd party solutions in this case
phuclv's user avatar
  • 28k
31 votes
Accepted

PowerShell: How do I append a prefix to all files in a directory?

An alternative approach to a regular expression would be to use simple string operations to create the new file name. $items=Get-ChildItem; $items | Rename-Item -NewName { "Prefix_" + $_....
Seth's user avatar
  • 9,193
23 votes
Accepted

Is there a way to change multiple file extensions at once on Windows 10?

You have a few utilities available. Powershell Use Rename-Item in combination with Get-ChildItem Get-ChildItem "*.png" | Rename-Item -NewName { $_.Name -replace "\.png$",".jpg&...
Reddy Lutonadio's user avatar
18 votes
Accepted

How can I skip a cycle in a FOR loop?

Just place a label :nextiteration (or whatever other name you like) as the last statement inside the for-loops body and goto to that label when you decide that you can skip the rest of the for-body. ...
Tonny's user avatar
  • 31.8k
15 votes
Accepted

How can I batch rename windows files where the % is a delimiter?

If you're on Windows 10, you should be learning & using Powershell for administration & automation. It's very powerful and a lot of fun. With your sample names and desired result, I opted to ...
Keith Miller's user avatar
  • 9,708
14 votes

PowerShell: How do I append a prefix to all files in a directory?

You are quite near. -replace uses RegEX and in a Regular Expression you anchor at the beginning with a ^ for a suffix you can similarly replace the anchor at line end with $ to avoid any possible ...
LotPings's user avatar
  • 7,251
14 votes

Add .mp3 to the end of file names

LOL. so you have a bunch of numbered extensionless music files? Well, we can get the extension fixed so you can play the files. Also, once they're recognized as .mp3 files, they most likely will be ...
Keith Miller's user avatar
  • 9,708
11 votes

Is there a way to batch rename files to lowercase?

Here is a proper recursive command line solution using only native cmd.exe commands that actually works. I believe it is the simplest possible native solution: for /r %D in (.) do @for /f "eol=: ...
dbenham's user avatar
  • 11.5k
10 votes
Accepted

Windows CMD: Add Suffix to all files in folder

As others told, it lies in the way ren interprets wildcards, that's why it can't find files that contains dots *.* in second command, because: You not only removed file extension using first command, ...
NetwOrchestration's user avatar
9 votes

Batch rename Chrome bookmarks

Export bookmarks (Bookmarks->Bookmarks Manager->Click column in upper righthand side that has 3 vertical dots->Export Bookmarks) Make a backup of the bookmarks file incase you mess up Open the file ...
BoldAsLove's user avatar
9 votes

Is there a way to batch rename files to lowercase?

"Recursive" version of the accepted answer (that works*) for /f "Tokens=*" %f in ('cmd /c "echo %cd%& dir /l/b/ad/s"') do (for /f "Tokens=*" %g in ('dir /l/b/a-d "%f"') do (rename "%f"\"%g" "%g"))...
wc.matteo's user avatar
9 votes

Batch command to rename filenames like 'The Kids Performances (2020).mp4' to 'Kids Performances, The (2020).mp4'

PowerShell with easily expandable Article list & extension list (We can use -whatIf for testing and then later delete it to execute our changes.) $ArticleList = @( 'A' , 'The' ) $ExtList = @( ...
Keith Miller's user avatar
  • 9,708
8 votes

Mass Remove File Prefix on a Mac?

A quick visit from the year 2019 to give an update. osX has something like this built into finder now. Open finder Select all the files you want renamed From the right-click menu (or File menu) ...
tbernard's user avatar
  • 181
7 votes

How can I batch rename windows files where the % is a delimiter?

I would write a PowerShell script that iterates over the file names and rewrites them with the following: $dir = Get-ChildItem -Path "PUTFULLPATHHERETODIRECTORY" foreach($P in $dir) { Rename-Item ...
Meow_ly's user avatar
  • 331
6 votes

install rename command in cygwin

The program with regular expression functionality that you require is a Perl script, sometimes called Perl Rename, or prename. It is usually distributed with Perl and is a different program to the ...
Ian Mackinnon's user avatar
6 votes

Add .mp3 to the end of file names

Ex Falso free open source audio tag editor for Windows/Mac/Linux can do exactly what you want. Ex Falso automatically identifies all mp3 files as mp3 whether they have an .mp3 extension or not. Just ...
karel's user avatar
  • 13.5k
6 votes
Accepted

Windows Explorer doesn't show updated names when changing capitalization (multiple files via script)

A script like this could help you: $windows = $(New-Object -ComObject Shell.Application).Windows() $windows | ? { $_.FullName -eq "C:\Windows\explorer.exe" -and $_.LocationURL -match "$...
Destroy666's user avatar
  • 7,025
5 votes
Accepted

How to batch remove file extensions on mac using csh or bash?

This should do it: find / -type f -name '*.dcm' -exec sh -c 'mv -- "$0" "${0%.dcm}"' {} \; The command: Recurses from / Finds every file named *.dcm Executes a small subshell call with one argument,...
slhck's user avatar
  • 229k
5 votes
Accepted

How to rename my folder and any of its subfolders into lowercase using command prompt in Windows?

It's much easier to use PowerShell instead of the legacy cmd Get-ChildItem -Directory -Recurse | Rename-Item -NewName { $_.Name.ToLower() } -WhatIf Shorter version ls -Di -R | ren -Ne { $_.Name....
phuclv's user avatar
  • 28k
4 votes
Accepted

How to change date format in file name using bash/linux?

With Perl's rename: rename 's/([0-9]{2})-([0-9]{2})-([0-9]{4})/$3-$2-$1/' *.pdf See: man rename
Cyrus's user avatar
  • 5,601
4 votes

Windows 7 command to add a leading zero to a batch of filenames

This powershell script should work just fine to add a 0 to the beginning of each filename in a folder. Save this script as a .ps1. Get-ChildItem -Path "C:\temp\cityfiles\" | Rename-Item -NewName {$...
Narzard's user avatar
  • 3,707
4 votes

Windows batch file to move files to subfolders based on first word in file name?

Use one for to iterate folder content %%A with a pattern containing at least one space. Another for /fis needed to split the name %%A into two parts, one before the first space tokens=1 = %%B and the ...
LotPings's user avatar
  • 7,251
4 votes

How can I batch rename windows files where the % is a delimiter?

Use *5c as a delimiter and obtain target name substrings by the set command, and this will get the last part of the file name without worrying if it is token 5, 6, 7, etc, because that always get the ...
Io-oI's user avatar
  • 8,252
4 votes
Accepted

Renaming multiple folder using command line

What can and will help in many commands would be to familiarizing yourself with: For For /r For /d Set Set string manipulation (substrings) For loop expanding variables Using a Forloop you can ...
Io-oI's user avatar
  • 8,252
4 votes
Accepted

Windows rename multiple images

Try using ren: Ren "*.png" "p*.png" for %i in ("c:\your\folder\*.png")do ren "%~i" "p%~nxi" rem :: in bat file: for %%i in ("c:\your\folder\*....
Io-oI's user avatar
  • 8,252
4 votes

Windows rename multiple images

Try this using Powershell: Get-ChildItem "Filepath" -Filter *.png | Rename-Item -Newname {"p" + $_.name} Short style: Ls "Filepath" -filter *.png | Ren -newname {"p&...
Wasif's user avatar
  • 8,534
4 votes

Changing hyphens (-) to underscores (_) on Win10 for many files: Windows search hack

For cmd/command line use ren/rename in for loop and substring replace variable:-=_": // in bat :: for %%i in (*-*.*)do set "_name=%%~ni" && cmd/v/c "ren "%%~i" ...
Io-oI's user avatar
  • 8,252
4 votes

How to increase numbers in filenames by specified value with Windows 10 PowerToys's PowerRename?

The PowerShell option: $Increment = 15 Get-ChildItem | Where Name -match '^(\d+)(.+)$' | Select FullName, @{ N = 'Index' ; E = { [Int]$Matches[1] }}, @{ N = 'NameText' ; E ...
Keith Miller's user avatar
  • 9,708
4 votes
Accepted

How I can rename txt files according to first line of text file?

mv oldname.txt `head -1 oldname.txt`.txt
Virsacer's user avatar
  • 365

Only top scored, non community-wiki answers of a minimum length are eligible