Command Prompt files move from one dir to other . bat
Posted on 2013-01-16
Hello I hope someone can help me with one sample code in ms-dos command prompt .bat file to move files from one dir to other and repeat automatic again and again endless but this is what I need:
1.-I have 2 dirs first dir called c:\dir1 files will be copied to this directory automatic by users no needed to do nothing there, now I want the .bat file when execute each time the .bat (because remember the .bat must autorun forever and ever), but when execute at first time of each automatic run the .bat must make a pause of 2 minutes then move one file of c:\dir1 (just one file of the dir will be moved the other files not copied must be untouched in c:\dir1) to the other dir called c:\dir2, when runs again the .bat file the .bat will make the pause of 2 minutes then again move only other file from c:\dir1 to c:\dir2 and in that way in an endless loop.
2.-If c:\dir1 is empty then the autorun does nothing just make the pause of 2 minutes.
looking the procedure visually this is what it does:
a.-Initial run check if no files are on c:\dir1 if no files then make a pause of 2 minutes only and re run again the .bat if files found in the dir then:
b.-Make a pause of 2 minutes waiting time (no problem if other 2 minutes of wait time if no files found and after files found by the .bat).
c.-Then move one file of the dir c:\dir1 to c:\dir2 with no particular characteristics or order of the file to be moved just the .bat read the dir and choose the file, only one file of the list of files of that c:\dir1 and move to c:\dir2 like I said.
d.-After move the file the script re run again in othwr words starts again from point "a" from this list I made and on hat way forever and ever the script must run.
If you see the goal is move all files of c:\dir1 to c:\dir2 slowly in other words the c:\dir1 will be enpty after move all files, off course if users copy more files to c:\dir1 the script detect that and continue doing the work like the points above described.
I don't know so much of command prompt but I need that I hope someone can help in sample code to do.