![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | rename all files from a directory to a list of files ... hi, what is a script to rename files like track 01a.mp3 track 02a.mp3 track 03a.mp3 track 04a.mp3 .... to track 01.mp3 track 02.mp3 track 03.mp3 track 04.mp3 .... i know the rename command rni, please help regards |
My System Specs![]() |
| | #2 (permalink) |
| | Re: rename all files from a directory to a list of files ... <show3r@gmail.com> wrote in message news:1188069160.537914.135060@r23g2000prd.googlegroups.com... > hi, > > what is a script to rename files like > > track 01a.mp3 > track 02a.mp3 > track 03a.mp3 > track 04a.mp3 > ... > > to > > track 01.mp3 > track 02.mp3 > track 03.mp3 > track 04.mp3 > This should do the trick: Get-ChildItem *a.mp3 | foreach { $_.name -replace '(.*?)a\.mp3', '$1.mp3'} -- Keith |
My System Specs![]() |
| | #3 (permalink) |
| | Re: rename all files from a directory to a list of files ... Keith Hill wrote: > <show3r@gmail.com> wrote in message > news:1188069160.537914.135060@r23g2000prd.googlegroups.com... >> hi, >> >> what is a script to rename files like >> >> track 01a.mp3 >> track 02a.mp3 >> track 03a.mp3 >> track 04a.mp3 >> ... >> >> to >> >> track 01.mp3 >> track 02.mp3 >> track 03.mp3 >> track 04.mp3 >> > > This should do the trick: > > Get-ChildItem *a.mp3 | foreach { $_.name -replace '(.*?)a\.mp3', '$1.mp3'} > I've worlds to go to keep up with Keith's pace and expertise, but here is my try: foreach($f in (Get-ChildItem *a.mp3))` {rename-item $f.name ($f.name -replace 'a\.', '.') -whatIf} If output looks ok, remove the -whatif or the shorter foreach($f in (GCI *a.mp3)){rni $f.name ($f.name -replace 'a\.', '.')} -- Greetings Matthias |
My System Specs![]() |
| | #4 (permalink) |
| | Re: rename all files from a directory to a list of files ... On 25 Aug., 23:05, Matthias Tacke <Matth...@Tacke.de> wrote: > Keith Hill wrote: > > <sho...@gmail.com> wrote in message > >news:1188069160.537914.135060@r23g2000prd.googlegroups.com... > >> hi, > > >> what is a script to rename files like > > >> track 01a.mp3 > >> track 02a.mp3 > >> track 03a.mp3 > >> track 04a.mp3 > >> ... > > >> to > > >> track 01.mp3 > >> track 02.mp3 > >> track 03.mp3 > >> track 04.mp3 > > > This should do the trick: > > > Get-ChildItem *a.mp3 | foreach { $_.name -replace '(.*?)a\.mp3', '$1.mp3'} > > I've worlds to go to keep up with Keith's pace and expertise, but here is > my try: > > foreach($f in (Get-ChildItem *a.mp3))` > {rename-item $f.name ($f.name -replace 'a\.', '.') -whatIf} > > If output looks ok, remove the -whatif > > or the shorter > foreach($f in (GCI *a.mp3)){rni $f.name ($f.name -replace 'a\.', '.')} > > -- > Greetings > Matthias thx for your help regards |
My System Specs![]() |
| | #5 (permalink) |
| | Re: rename all files from a directory to a list of files ... "Matthias Tacke" <Matthias@Tacke.de> wrote in message news:faq5jb$mvm$1@news.albasani.net... > I've worlds to go to keep up with Keith's pace and expertise, Nonsense. I posted the wrong friggin' snippet (that was my test code - doh!). What I should have posted was this: gci *a.mp3 | rename-item -NewName { $_.name -replace '(.*?)a\.mp3', '$1.mp3'} That's what I get for trying to answer one more post when I'm getting "the look" that we should have left for the in-laws 10 minutes ago. :-) -- Keith |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| How to list all files under a directory? | Vista General | |||
| Creating a list of files that have been deleted from or added to a directory | PowerShell | |||
| Copying files to Program Files directory | Vista file management | |||
| rename files (lots of files for newbie) | PowerShell | |||
| cant delete files or rename files | Vista security | |||