Hi,
I wanted to write a batch file where when ran it will check if a certain directory is empty and if it isnt, it will copy all the files within that directory to another location. I have to check if the folder is empty because the batch file also creates a folder named as today’s date to move the files to. I dont want to create a date folder if there is nothing to copy. I found the following code online and it works perfectly but as i am only starting out writing batch i have no idea what it means. I just dont see how it does what it does by looking at it. the code is as follows:
for /f %%a in (‘dir /b /a-d “%dirtocheck%”‘) do set empty=false & goto movestuff
Where ‘dirtocheck’ is the location of the directory i want to check for the presence of files. Can somebody explain it to me? Thanks a lot.