Freigeben über


Bulk Convert DOC to DOCX

Microsoft has a bulk conversion utility that can convert multiple DOC files to DOCX files.  This blog post presents very basic information on its use.  This utility has been around for a while, but a fair number of people don’t know of its existence.  Because it’s a powerful tool designed to convert all files on a server (or even a bunch of servers), its use is a little cryptic.  This is fine for IT professionals, but if all you want to do is bulk convert a single directory of DOC files, this post shows what you need to do.

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOCBefore you can use this tool, you need to install the Microsoft Office Compatibility Pack.  While the compatibility pack is primarily used with Office 2003 to allow it to load and save Open XML files, in essence, the compatibility pack is comprised of file format converters, which the Office File Converter (OFC) uses.  To use OFC, you need to install the compatibility pack even if you only have Office 2007 installed.  Download the compatibility pack here.

Next, you need to download and install the Microsoft Office Migration Planning Manager (OMPM).  This contains a bunch of stuff, but for bulk file conversion, we are primarily interested in just one tool, OFC.EXE.  Download the Microsoft Office Migration Planning Manager here.

When installing, as usual, you will select the installation directory.  OFC.EXE is in the Tools directory under the installation directory.  In addition, in that directory, there is a sample OFC.INI file.  To run OFC.EXE, you need to create an OFC.INI, and place it in the directory where you run OFC.EXE from.

For my simple example, I want to convert all DOC files found in the C:UsersericwhitDocuments and place the converted DOCX files in C:UsersericwhitDocuments Here is the OFC.INI file for this scenario:

[Run]
LogDestinationPath=C:UsersericwhitDocuments
TimeOut = 3

[ConversionOptions]
; FullUpgradeOnOpen: if set to 1, Word documents will be fully converted to the OpenXML format
; if set to 0 (default), Word documents will be saved in the OpenXML format in compatibility mode
FullUpgradeOnOpen=1

CABLogs=0

MacroControl=0

[FoldersToConvert]
fldr=C:UsersericwhitDocuments

[ConversionInfo]
SourcePathTemplate=********************
DestinationPathTemplate=C:UsersericwhitDocuments

The SourcePathTemplate and DestinationPathTemplate provide extremely flexible configuration for bulk conversion of a large number of directories.  They allow an IT professional to, say, convert files from one entire server, place the converted files on a different server, and use various sub-paths of the path of the source document to form the path where the DOCX will be placed.  Fully configuring SourcePathTemplate and DestinationPathTemplate is beyond the scope of this blog post.  The configuration above basically specifies to just take all of the DOC files in the specified fldr directory, and place them in the specified DestinationPathTemplate directory.

So, place a modified version of the above INI file in some directory, and run OFC.EXE from that directory.  You will see something like this:

 Your newly created DOCX files will be in the directory you specified in DestinationPathTemplate.

Comments

  • Anonymous
    September 30, 2008
    Voici les quelques liens techniques intéressants autour de Open XML de cette dernière semaine : Créer

  • Anonymous
    September 30, 2008
    Voici les quelques liens techniques intéressants autour de Open XML de cette dernière semaine : Créer

  • Anonymous
    November 12, 2008
    Thanks for posting this, very big time saver.  I was wondering if there is a simple command to put in the INI file to do a folder and all of it's subfolders

  • Anonymous
    November 24, 2008
    The comment has been removed

  • Anonymous
    December 05, 2008
    I was wondering if this could be used to convert from DOCX to just DOC?Thanks,Callum

  • Anonymous
    December 08, 2008
    Hi Callum,This utility only converts from DOC to DOCX.-Eric

  • Anonymous
    January 09, 2009
    This creates duplicate copies in the new format, it does not convert in the sense of the word. what most people need is to convert the doc file to docx, not to make another copy in a different location. How can you tell this tool to remove the old doc files after it's created the new docx files?

  • Anonymous
    January 09, 2009
    Hi Leo, yes, it's true that OFC.EXE only converts files, and doesn't remove old ones.  To implement something like this is pretty easy using PowerShell.-Eric

  • Anonymous
    March 09, 2009
    I'm not familiar wih using that, has anyone got something already that I could use or toy with?

  • Anonymous
    March 10, 2009
    A few months ago I thought of this. I wanted an explorer add-in that would allow me to right click...

  • Anonymous
    April 16, 2009
    Why not have a built in way for it to clean up after a successful conversion?  We have hundreds of thousands of files to convert and do not want to create duplicates.  We want to benefit from the reduced file size to shrink our file storage needs.  Powershell is not much of a solution, if I didn't like GUI's, I would switch to Unix!

  • Anonymous
    April 17, 2009
    Hi Robert,I don't know the reasoning of the dev team, but I would guess that it's because removing documents gets into the whole area of document retention policies - who can delete which documents - what about documents that are owned by someone who doesn't want them deleted, etc.  This is an extremely complicated issue, and adding functionality into a document conversion tool that encroaches on the issues of document retention would really complicate the tool.One approach - you can configure OFC.INI to convert documents and place the new documents in a parallel directory structure.  You can then delete the original directory structure with a single command, which reduces your burden significantly.-Eric

  • Anonymous
    April 20, 2009
    I can see your point, but can you imagine moving 1500 users cheese on them?  I have thought about converting one home directory at a time, putting all the converted docs in one place, and then moving them back.  Can you see where I am going here?  Anyway, I guess after about 10 or so years, all the old docs and spreadsheets will be gone.I just wish a tool could be developed to make this task feasible for large amounts of files so the end users do not feel the pain.  I guess until something third party comes out since Microsoft evidently has no intentions of doing it, we will not benefit from the XML format except in newly created files.

  • Anonymous
    May 27, 2009
    Actually you don't need the ofc just the compatibility pack. You can use the commandline (good for batch scripting/ powershell for those looking for a different behaviour than the ofc offers):"C:Program FilesMicrosoft OfficeOffice12wordconv.exe" -oice -nme <input file> <output file>

  • Anonymous
    July 12, 2009
    I have converted the file doc to docx format. But I could find that the Document variables in the file has got corrupted. And also, I have tried the convert in the Office Menu Button.

  • Anonymous
    August 14, 2009
    The comment has been removed

  • Anonymous
    October 13, 2009
    I have been struggling with this issue forsome time now. I have several hundred documents created in MSOffice 98 for Mac, and I want some way to convert them in bulk. I have tried this conversion program, and it only converts a handful of documents-I'm assuming just the ones that were written in a more recent version of office. Is there any way anyone can helpme figure out how to convert these files, other than loading each one up on the mac and going through the steps to savethem in a different format? Thanks.Davey.vee AT Gmail DOT com

  • Anonymous
    April 25, 2010
    it is taking all the files and put them all in one folder it is not creating the subfolders!could u tell me how can i make the INI creat the subfolders ?it will take long time to creat the subfolders and arrange the files again.

  • Anonymous
    October 19, 2010
    I have try this tool, but when i open the converted docx, it seems that these stay in compatibility modus. I think the compatibility pack is only for office2007?I have also tried FullUpgradeOnOpen=1, but the compatibility modus on the document stay.

  • Anonymous
    February 01, 2011
    You shouldn't need twice the storage space as the new files should be significantly smaller.  However, I have found that files with inserted images do not compress much.Re: removing orginal files...If you feel confident that the file conversion was successful, just do a search for .doc, select all, hit Delete.

  • Anonymous
    February 10, 2011
    I did a bulk convert on a folder, one of the main reasons was to reduce the overall size of the word documents.  But I found that using the ofc utility treats the file differently than converting it using Word.  There were 452 files and 128MB in the .doc format, after converting to .docx format, the folder size grew to 141MB and 434 files, as not all the files in the original folder ended up being word documents.  I checked one of the files that got larger 30MB to 46MB and opened the original in Word 2007, saved as a 2007 document and the resulting file size was 27MB.Any thoughts on what may be causing this? I have compatibility on in both scenarios, there are no macros... We have about 5 Gigs of .doc files and I was hoping to reduce that, not grow it.  Any help would be appreciated.Thank you

  • Anonymous
    March 11, 2011
    Very helpful, especially since the ofc.exe will crash, providing no feedback at all, if you type the SourcePathTemplate and DestinationPathTemplate incorrectly--which on my machine, included leaving them in their original format.

  • Anonymous
    March 11, 2011
    It might be helpful if you also posted a link, where we could log bugs against ofc.exe....  When I converted from source = "c:StuffOld" to "c:Stuff", the directories directly underenath "old" vanished, leaving me with hundreds of directories splattered into the "stuff" directory, and trying to figure out which ones went where.

  • Anonymous
    June 19, 2012
    I am trying to convert word files (Office 97-2003) that open up and you must select RTF (Rich Text Formatting) before using the file as they were all converted from PDFs.  Is there a way to change the script to account for this and if so what is it?  I tried a test file for a normal word 2003 doc and it worked fine.  Just need to change the scrpit around a bit to account for this extra step. Please contact me at Mstretton@hatch.ca if you can be of any help.

  • Anonymous
    July 20, 2012
    Hi Riaan and Robert, please tell if you found the solution. I would like to do the same in my company, but I can't duplicate the files and require the users to clean the drives! I guess you are asking for the same as I do. I would be very grateful if you help me.My email address is xola87@yahoo.com

  • Anonymous
    August 31, 2012
    i have a quick questiion... i have 30,000 files to do and have 100's of nested folders, how can i leave them in the folders or moved them in to new location and keep the same folder names with new file.

  • Anonymous
    October 24, 2012
    http://saaspose.com/api/words also allows you to convert .doc file to .docx formats and to many other formats.

  • Anonymous
    April 26, 2013
    @billy sherlockUse the following for source and destination at the end of the ini file. Also make sure you have ConvertSubFolders=1 under [FoldersToConvert] as well.SourcePathTemplate=*DestinationPathTemplate=*1

  • Anonymous
    May 07, 2013
    Hi, I', getting an error: Failed to get date-time attributes.What should I do in order to fix this?Regards,Emanuel Santos

  • Anonymous
    January 28, 2014
    I have office 2010 installed on my computer and ofc won't run because "Format converters are not installed on this machine"

  • Anonymous
    February 20, 2014
    @Christos,despite having installed Office 2010, you need the FileFormatConverter Tool to let ofc.exe run.Please refer to technet.microsoft.com/.../cc179019(v=office.14).aspx for further details.And as described, the files will just be converted from 2003 format to 2007 format.After converting *.doc to 2007 *.docx Format you will still get the hint in Word 2010, that thedocument is jsut opened in 'compatibility mode'.Hope This helps. Regards Arne

  • Anonymous
    October 17, 2014
    Convert docx to pdf: Visit:  www.youtube.com/watch

  • Anonymous
    October 18, 2014
    Hi, why not just do it with a simple easy DOS command:1/ Put all the files you want to change into one new folder in C:  (you can name it anything but I will call it "Test")2/ then (via Start) go to "Run" and type  CMD  (and enter) this opens a (black) DOS command space3/ in the black command space you type   CDTest  (and enter)   (CD means change directory)You are now in the folder "Test"4/Make sure you are now in your target folder "Test" or else you will chance other stuff also!Now type the DOS command   REN .  *.DOCX   (what you typed is: REN asterix dot asterix space asterix dot docx)What you did here is renaming for all files everything what is AFTER the dot into the new extention "docx"(Note: what is before the dot will not be renamed, since the asterix makes everything before the dot remain the same).P.s. BEFORE START:a/ make sure you can see the extensions after the dot since sometimes Windows hides themb/ Make also sure that you have everything in a COPY FOLDER in case yo make a mistake!!c/ experiment first with a folder with some files that would be no loss if you made a mistake!good luck!

  • Anonymous
    October 22, 2014
    @BeginnerThats not a conversion but a simple renaming and it will not work!Regards Poe

  • Anonymous
    October 30, 2014
    This converted all my .doc files to .docm files. I thought it was supposed to convert them to .docx, did I do something wrong?

  • Anonymous
    March 11, 2015
    This open source utility might be better:-sourceforge.net/.../b2xtranslator

  • Anonymous
    July 15, 2015
    Hi I what i need to add for add source sub folders , and while making the conversation it will be also create sub folders

  • Anonymous
    July 18, 2015
    Hi, what should I type in the DestinationPathTemplate if I want the new files to stay in the source folder of the DOC files?

  • Anonymous
    November 23, 2015
    Hi there, I presume this runs the word executable is that correct?  Is this safe to do on an unattended machine (automated process that converts .doc files to .docx as they come in, but with no human interaction).  Microsoft suggests that running word in headless mode is not suitable for unattended environments since the application may still show dialogs to the user.  Does OFC.exe just call into word? If so, does anyone know of a solution that is safe to run on an unattended computer?