What Is a DO File?

How to open, edit, & convert DO files

A file with the .DO file extension could be a Java Servlet file. It's used by Java web servers to deliver web-based Java applications.

Some DO files might instead be Stata Batch Analysis files. These are usually called do-files and are plain text files that contain a list of commands that are to be executed together in a series.

Similar to Stata files is the ModelSim macro file format that uses the .DO file extension to store macro-related commands used with Libero SoC.

Screenshot of several DO files used with Notepad in Windows 10
Tim Fisher

Others might be files that have simply been misnamed as DO files but actually exist in an entirely different file format. These are usually PDFs downloaded from a website that, for one reason or another, were incorrectly given the wrong file extension.

dofile is also a function used when compiling and executing Lua programming code, but it isn't related to the .DO file extension. It's also a loop command used with batch files. DO is an acronym as well, standing for domain object, digital output, digital order, data operation, data only, and device object.

How to Open a DO File

If it's a Java Servlet file, you should be able to open the DO file with Apache Tomcat, or possibly Apache Struts.

Stata Batch Analysis files with the .DO file extension only work within the context of a computer that's running Stata. One option for actually using the DO file within Stata is to enter do followed by the file name in the Stata command window. For example, do myfile.

You can use the included Stata Do-File Editor to read and edit the commands, but any web browser can also be used to view the commands, and a text editor like Notepad++ can view and edit the DO file. The Stata editor is also useful for executing the DO file; just hit the Execute do file button.

See this PDF on creating Stata do-files if you need help. There's more information available from Stata's website, too.

ModelSim DO files are used with Mentor Graphics ModelSim, which is included in the Libero SoC program suite. These are also plain text files that can be viewed and edited with any text editor program.

If you suspect that your DO file shouldn't be a DO file and is, in fact, a document, like a bank statement or some sort of insurance-related document, just rename the .DO file extension to .PDF and see if it opens with a PDF reader like SumatraPDF, Adobe Reader, or one of these free options.

How to Convert DO Files

If a Java Servlet file is able to be converted to any other format, it's most likely done through the Apache programs mentioned above. Open the file in the application and look for some kind of Save as or Export menu that will let you save the DO file to another file format.

Stata Batch Analysis files can surely be converted to other text-based formats like TXT but it's only useful if you want to read through the commands. If you do end up changing the file format it's in (to something like TXT), and you still want to run the commands with Stata, you have to specify the file extension in the command (e.g., do myfile.txt instead of do myfile, which assumes the .DO file extension).

The same is true for ModelSim DO files; try using the menu within Libero SoC to convert the file or plug the macro's text into a text editor and save it to a new text-based format there.

If your file has been mistakenly given the .DO file extension but should really have the .PDF suffix, you don't have to worry about converting the DO file to PDF. Instead, just rename the .DO file extension to .PDF so that your PDF reader will recognize the file.

Renaming like this isn't how file conversions work, but it does work in this scenario since the PDF shouldn't have been using the .DO file extension anyway. File converter tools are used for true file conversions.

Still Can't Open the File?

The most obvious reason for why a file won't open with the programs mentioned above is that it's not actually in any of these file formats. Double-check that the file extension reads ".DO" and not something similar like SO, DOCX, DOC, DOP, DM, etc.

Those other file extensions, or any other one that isn't true .DO, belong to file formats that are unrelated to any of the formats mentioned here, which is why they won't open with the same software.

If you have one of those files instead, follow those links or research the file extension for more information about how to open that particular file.

Was this page helpful?