Is it possible to remove the "Directory" attribute using powershell? The reason I ask is there has been an ongoing issue with certain Western Digital devices for several years where files sporadically change into directories. I.e. what was once an MP3 file is now a directory with the exact name (including extension). I'm assuming it's some type of corruption, but i'm curious to see if it's just a corruption of the original files attributes to where the system thinks it's a directory. So far the solution is to just delete the file, which doesn't really solve the issue. But if I can alter the attributes to where the system thinks it's a file again then (i'm hoping) it will work again.
This is what I've been trying, but no luck (if it's even possible):
$file = (Get-ChildItem -Path "G:\Music\Song.mp3") $file.Attributes = $file.attributes -bxor [system.IO.FileAttributes]::NormalI've also gone up to just G:\Music for the path and then looped through with a ForEach-Object to modify the attributes of all child items.