1.

Solve : Batch Programming Question, How do you ...?

Answer»

Hello ... I need a batch that will write an incremental folder structure, such as test to see if the folder exists and if it doesn't create it, and copy data from point A a Static Drop Point to Point B being the next available value folder just created 1, 2,3 etc. I am thinking that I can use the IF EXIST function to test for the folders, but dont know how to go about this part past that.

I would like to keep it simple with folders named 1,2,3... and so on, so that the folder name ( a value ) such as 1,2, or 3 can be read and dropped into into the batch into a variable such as FOLDER and then FOLDER++ (increment) to create the next available folder name ( number ) 2, 3, 4 and so on.

One of my friends who knows more about Batch Programming than I said that it should be able to be done, but its above my Batch Programming knowledge, and above his as well, so I figured I would post this to the group and see if an Expert or more advanced Novice may be able to post an example of how to do this.

BTW: This batch will execute on a Windows XP Pro SP2 system ....

Many THANKS in advance if this can be done and for your help... DaveThis is not very elegant and probably should be written to be more bulletproof, but on the day after Thanksgiving I'm fat and lazy.

Code: [Select]@echo off
for /l %%x in (1,1,1000) do (
if not exist c:\PointB%%x call :makecopy %%x & GOTO :eof
)

:makecopy
md c:\PointB%1
copy c:\PointA\filename c:\PointB%1

If you feel 1000 is not large enough, try something bigger. 8-)Hey...Many Thanks again Sidewinder. This will work perfect for my application. I am kind of amazed that it is pretty straight forward when looking at it now. I had a feeling that a FOR statement would be needed like you posted to count from 1 to 1000 in increments of 1. I DIDNT think about the EOF statement, but it is very important to making this work the way that it does.

I suppose I should invest in an Idiots Guide to Batch Programming/Coding and read up to get better ejamakated on this STUFF since I am working with it more regularly now ...

Thanks for coming through for me on my %date% to %today% format CONVERTER the other day and today with this. I wish I can return the favor at some point through this forum



Discussion

No Comment Found