+ Reply to Thread
Results 1 to 5 of 5

Add Prefix to Every Filename in Folder and Subfolders

  1. #1
    Registered User
    Join Date
    03-31-2023
    Location
    United States
    MS-Off Ver
    2302
    Posts
    4

    Add Prefix to Every Filename in Folder and Subfolders

    Hi, I'm trying to find VBA to add the prefix "EN-" (without the quotes) to every filename in a folder, as well as for all files in every subfolder. These will be mostly .md files, but they could be Word docs, PDFs, text files, or other kinds. Regardless of the file type, the same prefix is used.

    For example, if the folder "C:\Users\raymo\Documents\Evernote" contains the filename is "Rev 15.md" then the new filename will be "EN-Rev 15.md"

    I saw some related posts, though I was struggling to find something that looped through subfolders as well. Thanks for your help.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Add Prefix to Every Filename in Folder and Subfolders

    You could actually do that with a one-liner from a command prompt like:

    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    03-31-2023
    Location
    United States
    MS-Off Ver
    2302
    Posts
    4

    Re: Add Prefix to Every Filename in Folder and Subfolders

    Thank you very much, this solved the problem. [Edit - see following post, unfortunately this clears the file type.]

    There's a different problem I didn't previously consider. Would you know how to exclude all folders named "_resources"? The files in other folders reference the resources in those folders, but the reference location breaks if I change the filenames in the "_resources" folders.
    Last edited by FiatMihi; 01-23-2024 at 03:29 PM.

  4. #4
    Registered User
    Join Date
    03-31-2023
    Location
    United States
    MS-Off Ver
    2302
    Posts
    4

    Re: Add Prefix to Every Filename in Folder and Subfolders

    Quote Originally Posted by rorya View Post
    You could actually do that with a one-liner from a command prompt like:

    Please Login or Register  to view this content.
    Actually, this cleared the file type. Is there a way to do this while preserving the original file type (.md, .pdf, etc.)?

  5. #5
    Registered User
    Join Date
    03-31-2023
    Location
    United States
    MS-Off Ver
    2302
    Posts
    4

    Re: Add Prefix to Every Filename in Folder and Subfolders

    Actually, I found this online utility that works - Bulk Rename Utility. I'm not able to post a hyperlink, but a Google search can find it for download.

    Thanks still for your reply. It got me to that utility that worked well enough for my purposes.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] list of subfolders in folder - without files and sub-subfolders
    By MartyZ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2022, 10:56 AM
  2. Search within subfolders to copy files to another main folder with subfolders
    By jimjones1958 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-13-2022, 10:44 AM
  3. Cut and paste data from source folder (with multiple subfolders) to destination folder
    By jimpatel1993 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-05-2021, 05:28 AM
  4. VBA Copy specific files listed in Excel from folder & subfolders to another folder - FSO
    By HelloFriends in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-03-2019, 02:55 PM
  5. [SOLVED] macro to delete prefix and file extension through desktop and its subfolders
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-28-2018, 06:08 PM
  6. Counting files in folder including subfolders also and folder size
    By mido609 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2012, 03:26 PM
  7. Replies: 2
    Last Post: 05-07-2006, 03:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1