FN-GM Posted November 17, 2016 Posted November 17, 2016 Hello, Does anyone have a script I could use that looks at a folder and sub folders and finds files that are .doc and changes to extension to .docx please? I know its a bit of a bodge, but for what we need it does solve an issue Thanks
Steve21 Posted November 17, 2016 Posted November 17, 2016 Just to rename or to actually convert the filetype? Steve 1
6Foot2 Posted November 17, 2016 Posted November 17, 2016 Have a look at this post in an old thread: Link: http://www.edugeek.net/forums/how-do-you-do/3906-rename-batch-files-all-once.html Might do the job for you? 1
FN-GM Posted November 17, 2016 Author Posted November 17, 2016 Have a look at this post in an old thread: Link: http://www.edugeek.net/forums/how-do-you-do/3906-rename-batch-files-all-once.html Might do the job for you? I already use this tool, its really handy, but I can't go into sub folders. Thanks anyway.
bicky Posted November 17, 2016 Posted November 17, 2016 (edited) use Bulk Rename Utility (bulkrenameutility.co.uk) On Windows Explorer, Open root folder then do a search *.doc (top right) Select all (ctrl A) from the search results, then drag them to the Bulk Rename Utility and rename the extension Edited November 17, 2016 by bicky 1
clareq Posted November 17, 2016 Posted November 17, 2016 look at pfrank - PFrank File Renamer I've yet to find anything I can't rename with it!
FN-GM Posted November 17, 2016 Author Posted November 17, 2016 use Bulk Rename Utility (bulkrenameutility.co.uk) On Windows Explorer, Open root folder then do a search *.doc (top right) Select all (ctrl A) from the search results, then drag them to the Bulk Rename Utility and rename the extension Been using that for years and didn't know you could do that!! thanks.
HPlum78 Posted November 17, 2016 Posted November 17, 2016 (edited) Set-Location E:\Local\Tmp #Parent Folder - where the files live $FileList = Get-ChildItem -Recurse | ? {$_.Extension -eq ".doc"} #Gets a list of files where the Extension is = to .DOC # foreach-object loop gets the name of the file and then builds a new file name with the replacement extension - in this case .DOCX $FileList | % { $FileNameNew = $_.BaseName + ".docx" Rename-Item -Path $_.PSPath -NewName $FileNameNew } # End PowerShell? the above will do what you want, you ask for a script so you get a........ Right that will work, forgot about sub-folders! Edited November 17, 2016 by HPlum78
Arthur Posted November 17, 2016 Posted November 17, 2016 If you need to rename .doc files in different folders often, here's a PowerShell function that would help... function Invoke-Doc2Docx { Param( [parameter(Mandatory=$true)] [string]$Path ) Get-ChildItem -Path $Path -Include *.doc -File -Recurse | ForEach-Object { Try { Write-Output "Renaming $($_.FullName)" Rename-Item -Path $_.FullName -NewName ("{0}{1}" -f $($_.BaseName),'.docx') -ErrorAction Stop } Catch [Exception] { Write-Output "$_.Exception.Message" } } }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now