I would like to remove the word “.pdf” in the file name. It’s not the extension of the file as I named it with “.pdf” previously. How do I remove it on all of the files? My files are located in many folders within the main folder.
C:\MainFolder\Folder1\document.pdf
C:\MainFolder\Folder2\document
C:\MainFolder\Folder3\document.pdf
Get-ChildItem | Rename-Item -NewName { $_.BaseName.Replace(“.pdf”,””) + $_.Extension }
I tried using this but it only removes in the folder itself. I need to do it for all of the folders