Monday, April 10, 2017

windows 7 - Renaming multiple files in various folders to the same name in W7



I have a bunch of directories, each one contains exactly 1 file named folder.jpg. What I would like to do is to rename all the files cover.jpg, but when I do search on *.jpg and try to rename, it renames the first file to cover.jpg and every other file becomes cover (1).jpg.



Is there a way I can rename the files without tedious folder-by-folder renaming?


Answer



I would do this with PowerShell:




Get-ChildItem "C:\root\path" -Recurse -Filter "folder.jpg" | % {
Rename-Item $_.FullName "cover.jpg"
}

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...