Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Move files to folders with similar names...  (Read 41705 times)

0 Members and 1 Guest are viewing this topic.

CHF-Mark

    Topic Starter


    Newbie

    • Experience: Experienced
    • OS: Windows 10
    Move files to folders with similar names...
    « on: November 09, 2022, 08:43:48 PM »
    I am running Win 10 and would like to create a .bat file that accomplishes the following:

    Checks each filename in a folder and then compares them to folder names in another folder.
    If ANY part of the filenames match the folder name, move the file to that folder.

    So files would be located in this folder:  d:\data\special\
    And the folders to move these files to would be located here:  e:\

    So here are some example files:
    home garden.txt
    Photos home.doc
    Name home score.jpg

    And here are some folder names to move the files into:
    d:\garden
    d:\presents
    d:\chores
    etc.

    I'm sure a for loop would be needed to set this up but I don't have the skills
    to write the code.

    Any help would be appreciated!

    I've searched online for this but nothing quite fits the bill.

    CHF-Mark

      Topic Starter


      Newbie

      • Experience: Experienced
      • OS: Windows 10
      Re: Move files to folders with similar names...
      « Reply #1 on: November 10, 2022, 10:57:56 AM »


      So here are some example files:
      home garden.txt
      Photos home.doc
      Name home score.jpg

      And here are some folder names to move the files into:
      d:\garden
      d:\presents
      d:\chores
      etc.


      I see I need to adjust my example folders a bit.  :)

      And here are some folder names to move the files into:
      d:\garden
      d:\home
      d:\presents
      d:\chores
      etc.

      I hope it's clearer now.