windows - How to check out with Batch , if a folder contains a .txt file and then copy the folder into an other location? -


i make script batch. want script check out, if folder contains file, "list.txt", , if in folder want make copy in other location. wrote lines of code it's not working. ideas?

@echo off setlocal enabledelayedexpansion  :loop     /f %%i in ('dir "c:\users\ntosis\desktop\draft" /ad /o:d /s /b') (      set a=%%i         /r %%a %%t in (*.txt) if "%%~nxt"=="list.txt" set p=%%~dpnxt         echo !p!          if defined %p% ( robocopy c:\users\ntosis\desktop\draft\%a% c:\users\ntosis\desktop\copied\%a% /move /e ) )  echo folder empty or not exist timeout /t 15 goto loop 

the problem in moment second loop not check right.

how this:

for /f %%i in ('dir "c:\users\ntosis\desktop\draft" /ad /o:d /s /b') (      if exist "%%i\list.txt" (         robocopy %%i c:\users\ntosis\desktop\copied\ /move /e     ) ) 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -