Script package to find a folder inside subfolders and get the folder path

I am trying to create a batch file that will do the following:

  • Ask the user to enter a name. If no name is provided, ask again.
  • Find all the subfolders from the starting point (for example, C: \ Temp) for this name.
  • If it is found, I want to move the found folder and all contents to another directory.
  • If this is not found, inform the user that it was not found, and allow to try again or the application.

I was not very lucky to find an example of such a script or its pieces, even to put something together.

+6
source share
1 answer
@echo off for /d /r "c:\temp" %%a in (*) do if /i "%%~nxa"=="apples" set "folderpath=%%a" echo "%folderpath%" 
+13
source

Source: https://habr.com/ru/post/949744/


All Articles