Batch File to Loop Through Folders and Process If Specific File Found

23
2014-07
  • Jason C

    I have a large number of websites running the same CMS that I want to update as a batch. As the update process just requires copying the updated files into the folder of the given sites, a batch files seems suitable to the task.

    Is there a good method for iterating through a list of folders one level deep (don't need to check deeper), checking if a specific file exists in that folder, and if found, run some commands (in this case, I will have it run a command to copy from a destination to the folder)?

  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    Calling a batch file using relative path
  • Franz

    Oh gosh, gotta expose myself as a noob here ;)

    In Windows, I need to execute a batch file in a subdirectory of the working directory. However, just running subdir/foo.bat cmd1 cmd2 does not work, and I get an error saying

    The command "subdir" cannot be found.

    What am I doing wrong?


  • Related Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.