devxlogo

Using Dir Function

Using Dir Function

Question:
In a question off your list, you mentioned how to rename files given the same formatted extension.How would it be possible to do this to a different extention, e.g. *.htm files to *.html?

Answer:
In that case (assuming you can support long filenames) use the Dir$ function (called just “Dir” in VB4.0). It will return you a list of files matching a pattern. For each file, just rename it to whatever you want. You can use InStr to find the period in the filename, take the front part of the name and attach it to the new extension.

See also  11 Effective Keyword Research Tools and Techniques
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist