• 0

easy way to remove prefix to file names?


Question

I have a folder with filenames and they all have the prefix named

DDRM-filename1.doc

DDRM-filename2.doc

DDRM-filename3.doc

DDRM-filename4.doc

There has to be like 50 files and i just would like the DDRM part remove cause its annoying and

i figured there was a easier way then file rename each and every file. Is there a way to scan

a directory and change it with a bat or vbs file?

10 answers to this question

Recommended Posts

  • 0
  generalnewbie said:

I have a folder with filenames and they all have the prefix named

DDRM-filename1.doc

DDRM-filename2.doc

DDRM-filename3.doc

DDRM-filename4.doc

There has to be like 50 files and i just would like the DDRM part remove cause its annoying and

i figured there was a easier way then file rename each and every file. Is there a way to scan

a directory and change it with a bat or vbs file?

You can do this in Windows if you highlight all the files and right click-> rename. You will rename only one file (make sure its the top DDRM-filename1 file you right click) and the other will follow. You might not like the results because it will turn out like:

filename.doc

filename(1).doc

filename(2).doc

filename(3).doc

...

...

...

  • 0

Place this VBS Script in the folder that you want to change the names.

Save As ReName.vbs

  Quote
Const OverwriteExisting = True
 Dim File, Folder, StrF, StrT
 Dim Fso	 : Set Fso = CreateObject("Scripting.FileSystemObject")
'/-> Set The Folder Path
  Set Folder = Fso.GetFolder(Fso.GetParentFolderName(WScript.ScriptFullName))
'/-> Object For Collection
  Set File = Folder.Files 
   For Each StrF In File 
'/-> DDRM-filename1.doc Change This DDRM To Match What You Want To Filter
	If InStr(StrF.Name,"DDRMen 
	 StrT = Replace(StrF.Path, "DDRM-", "")
	 Fso.CopyFile(StrF.Path), (StrT),OverwriteExisting
	 Fso.DeleteFile(StrF.Path),True  
	End If 
   Next
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Also going from color to B&W is 100% noticeable. Does not mean anything is actually faster / more productive.
    • Governments begin warning all users on Windows 10 end of support and how to deal with it by Sayan Sen Last month, Microsoft issued a reminder about Windows 10's upcoming end of support date. The various hardware vendor partners of Microsoft like Asus have also published their guidance for the same, such that users can prepare for the "mandatory upgrade to Windows 11." While the upgrade is certainly not mandatory, as users can continue sticking to Windows 10 if they want, at least for a while, the governments are now beginning to issue advisories on the upcoming massive change. The Indian Computer Emergency Response Team (CERT-In) under the Government of India (GoI) has published guidance on the matter. Like Microsoft, Asus, and others, the GoI has also recommended upgrading to Windows 11 to keep their systems secure. In the new advisory, it writes: For enterprises as well as individual users who need more time to plan the upgrade, the CERT-In has reminded them about the Extended Security Updates (ESU) program. It writes: If you recall, Microsoft also extended the support for Microsoft 365 apps like Teams, Word, Excel, Outlook, OneDrive, and more, for another three years. You can find the advisory here under CIAD-2025-0023 on CERT-In's official website. Meanwhile, the United States' Cybersecurity and Infrastructure Security Agency (CISA) is probably going to publish its own official guidance sometime soon, similar to how it did for Windows 7 and others. Others like the EU are going to follow suit as well. If you do not like Microsoft's latest OS offering, you can also switch over to Linux. Recently, LibreOffice urged users to do so, citing the "real costs" of Windows 11.
    • This is just sad! https://www.instagram.com/reel/DLNd4fgp_Hb/
  • Recent Achievements

    • One Year In
      78andyp earned a badge
      One Year In
    • One Month Later
      Cottonbud earned a badge
      One Month Later
    • One Month Later
      langat earned a badge
      One Month Later
    • One Month Later
      Nullun earned a badge
      One Month Later
    • Week One Done
      moojay67 earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      598
    2. 2
      ATLien_0
      219
    3. 3
      Michael Scrip
      197
    4. 4
      +FloatingFatMan
      144
    5. 5
      Xenon
      135
  • Tell a friend

    Love Neowin? Tell a friend!