# Bulk MP3 extension rename .~#T0

This topic contains 9 replies, has 4 voices, and was last updated by  Jeff Taylor 5 months, 1 week ago.

Viewing 10 posts - 1 through 10 (of 10 total)
• Author
Posts
• #37965

Jeff Taylor
Participant

I've got an MP3 folder that apparently got stuck in a half state for archiving with an HP product some time ago.

So, some artists folders got renamed "~HpShadow" and then the mp3 files themselves got the extension renamed to .~#T0

I was hoping PS could help me find and rename these. (The Folder rename isn't necessary because the album name wouldn't be known, I'd have to do after a bit of research). But since the song titles are intact, I simply need to bulk rename the extensions to "mp3" and I believe that'll be good.

I have this so far:

$Dir = Get-ChildItem -dir F:\MP3s -Recurse < — works$List = $Dir | where {$_.extension -eq ".~#T0"} < —- error $list | ft name < —- just wanted to see a list of the files and location..but I'm not getting any results from my where statement. When I pipe Get-ChildItem -dir F:\MP3s -Recurse to gm I don't see Extension as a property. Moreover, I'm getting an errro about illegal character. Which one, the tilde?How can I find the files and rename them? #37966 Curtis Smith Participant The problem is going to be that you are using the -dir parameter with Get-ChildItem, which tells Get-ChildItem to only return directories, not files. Directories, of course, do not have extensions. -Directory Gets directories (folders). To get only directories, use the Directory parameter and omit the File parameter. To exclude directories, use the File parameter and omit the Directory parameter, or use the Attributes parameter. To get directories, use the Directory parameter, its "ad" alias, or the Directory attribute of the Attributes parameter.  #37971 random commandline Participant $files = Get-ChildItem -Path .\path\to\files -Filter '*.~#T0' -Recurse
"$($files.Count) files found"
$files.DirectoryName | Out-File .\path\to\files\parentlog.txt -Append$files | Rename-Item -NewName {$_.Name -replace '.~#T0','.mp3'} -whatif  #38000 Jeff Taylor Participant Curtis, How come neither the -dir nor the -file parameters are listed in the get-help get-childItem -Full help file? thanks #38007 Bob McCoy Participant The -dir and -file switches were introduced in v3. Are you running v3 or later? Have you updated your help files? #38008 Jeff Taylor Participant v4 but I can't update AD and GP modules for some reason. I do have an access denied issue open with MS on this very subject and also soliciting help from this forum: http://powershell.org/forums/topic/update-help-access-denied-on-domain-controller/ #38018 Curtis Smith Participant @jeff-taylor, in addition to Bob's reply, Get-ChildItem is used by much more than just a file system. It can work with other providers, such as the Registry, which does not support -directory and -file Here is a link to "Get-ChildItem for FileSystem" https://technet.microsoft.com/en-us/library/hh847897.aspx #38082 Jeff Taylor Participant random commanline thanks -whatif works great. How would I measure the number of files discovered/changed? I tried: Get-ChildItem -Path F:\MP3s -Filter '*.~#T0' -Recurse | Rename-Item -NewName {$_.Name -replace '.~#T0','.mp3'} -WhatIf | measure

returns value = 0

...and also, how can I log the returned parent folders which contain these files? I'll have to change the name from ~HPShadow to the album name after some analysis.

thanks again

#38093

random commandline
Participant

Try it again. I modified my script to display number of files found and output parent folders to a log file.

#38137

Jeff Taylor
Participant

random commandline Thanks a lot..Worked a charm and I learned a lot in the process...Cheers

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.