Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition password problem router slow software sound trojan usb video virus vista windows windows xp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Batch Files


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
abercabkar's Avatar
Junior Member with 1 posts.
 
Join Date: Sep 2001
25-Sep-2001, 03:48 PM #1
Question Batch Files
I beleive there is a way to create a .bat file to create folders within Windows Explorer. I need to create a sequence of folders named "100" thru to "299" then another sequence called "300" to "499" etc. With in these folder I need 2 sub folder created called "In" and "Out". If there is a way of doing this, I would appreciate an idiots guide, not very good with DOS.
Max19's Avatar
Account Disabled with 1,240 posts.
 
Join Date: Jul 2001
25-Sep-2001, 06:34 PM #2
The commands in the batch file would be:

md c:\100
md c:\100\In
md c:\100\Out
md c:\101
md c:\101\In
md c:\101\Out

If you're looking for a way to automate this, the only suggestion I'd have would be to use a programming language like Visual Basic. Then you could use For-Next loops with variables. I don't think you'll find an easy way to do this with a batch file.
MacFromOK's Avatar
Senior Member with 1,947 posts.
 
Join Date: Mar 2001
Location: Oklahoma
Experience: idiota de la aldea
26-Sep-2001, 12:20 AM #3
I agree with Max on this, there's no way to
increment numbers like this in a batch file
without a utility like PC magazine's
BATCHMAN or something similiar.

There is a free 16-bit version of VDS. It won't
make compiled executables, but you can
call the interpreter with the script file as a
command parameter, and create a shortcut
to it. Check the link in my signature if you're
interested.

The free version is kind of a "Windows batch
utility", but it does math and a lot of stuff a
batch file can't do alone.

Cheers, Mac
__________________
MacFromOK : PC User
Do I have all the answers?
I don't even have all the questions!

____________________________________________________________
Ratboy's Avatar
Senior Member with 934 posts.
 
Join Date: Feb 1999
Location: La Verne, CA USA
Experience: Know how to handle a mouse
26-Sep-2001, 02:27 AM #4
Talking Ye of little faith.
The batch file attached will create the needed folders. I named it makeit.txt so that I could include it as an attachment. Save it to your HDD and rename it whatever you like with a *.bat extension (ex. makeit.bat).


The two important sections are as follows:

At the beginning of the file:

ECHO Creating Folders...
set E2=0
set E1=9
set E0=9
:START
IF %E2%%E1%%E0%==299 GOTO END


E2; E1; E0 is set to one less than the starting point. In this case 099.

The IF statement indicates the last folder that should be created. In this case 299.

At the end of the file:

:MAKE
md c:\"temp"\%E2%%E1%%E0%
md c:\"temp"\%E2%%E1%%E0%\In
md c:\"temp"\%E2%%E1%%E0%\Out


This creates the folder and the In & Out sub folder. You will want to replace the temp directory with whatever directory you would want the folders in.

I found the main incrementation batch file here:

http://www.ericphelps.com/batch/samples/addition.txt
Attached Files
File Type: txt makeit.txt (1.1 KB, 207 views)
__________________
All those who believe in psychokinesis, raise my hand.
Ratboy's Avatar
Senior Member with 934 posts.
 
Join Date: Feb 1999
Location: La Verne, CA USA
Experience: Know how to handle a mouse
26-Sep-2001, 02:38 AM #5
Cool Part 2:
This one will create the 300 - 499 folders.
Attached Files
File Type: txt makeit2.txt (1.1 KB, 81 views)
MacFromOK's Avatar
Senior Member with 1,947 posts.
 
Join Date: Mar 2001
Location: Oklahoma
Experience: idiota de la aldea
26-Sep-2001, 05:31 AM #6
VERY nice Ratboy.

I've always used batch utilities (even made a few),
so I never considered doing anything like this, but
I played around with this idea a while and made
this count procedure that goes from 000-1000.
You can set the "max" variable for the count limit
(add "D" digits and code if ya need more than 1000).
Code:
rem -- Do NOT set "max" above 1000, if less than
rem -- 1000, "max" must be 3 digits (009, 043, etc.).
rem -- D1 = 1s, D10 = 10s, D100 = 100s
@ECHO OFF
SET D1=0
SET D10=0
SET D100=0
SET max=1000

:COUNT
  echo %D100%%D10%%D1%
  if "%D1%"=="9" SET D1=10
  if "%D1%"=="8" SET D1=9
  if "%D1%"=="7" SET D1=8
  if "%D1%"=="6" SET D1=7
  if "%D1%"=="5" SET D1=6
  if "%D1%"=="4" SET D1=5
  if "%D1%"=="3" SET D1=4
  if "%D1%"=="2" SET D1=3
  if "%D1%"=="1" SET D1=2
  if "%D1%"=="0" SET D1=1
  if "%D100%%D10%%D1%"=="%max%" goto END
  if not "%D1%"=="10" goto COUNT
  SET D1=0
  if "%D10%"=="9" SET D10=10
  if "%D10%"=="8" SET D10=9
  if "%D10%"=="7" SET D10=8
  if "%D10%"=="6" SET D10=7
  if "%D10%"=="5" SET D10=6
  if "%D10%"=="4" SET D10=5
  if "%D10%"=="3" SET D10=4
  if "%D10%"=="2" SET D10=3
  if "%D10%"=="1" SET D10=2
  if "%D10%"=="0" SET D10=1
  if "%D100%%D10%%D1%"=="%max%" goto END
  if not "%D10%"=="10" goto COUNT
  SET D10=0
  if "%D100%"=="9" SET D100=10
  if "%D100%"=="8" SET D100=9
  if "%D100%"=="7" SET D100=8
  if "%D100%"=="6" SET D100=7
  if "%D100%"=="5" SET D100=6
  if "%D100%"=="4" SET D100=5
  if "%D100%"=="3" SET D100=4
  if "%D100%"=="2" SET D100=3
  if "%D100%"=="1" SET D100=2
  if "%D100%"=="0" SET D100=1
  if "%D100%%D10%%D1%"=="%max%" goto END
  if not "%D100%"=="10" goto COUNT
  goto END

:END
  echo %D100%%D10%%D1%
Cheers, Mac

BTW (on closer inspection), this goes to 1000
because of going from 9 to 10 on the D100 var.
So you can set "max" to 1000 if you want. I
changed the post to reflect this.
__________________
MacFromOK : PC User
Do I have all the answers?
I don't even have all the questions!

____________________________________________________________

Last edited by MacFromOK : 26-Sep-2001 03:48 PM.
The DOS Machine's Avatar
Senior Member with 144 posts.
 
Join Date: Jul 2000
Experience: Seasoned
27-Sep-2001, 04:27 PM #7
Man, you guys are good at batch!



-DOSMAN
motorfreak's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2004
Experience: Intermediate
28-Jun-2004, 06:33 AM #8
Hi Guys, Im new to this site, so bare with me.

I have a question on batch files, a bit like the one in this thread about creating directories but slightly a bit more advanced...

Ok, scenario, I have a digital camera which when linked to my PC creates a new drive for instance, E:, and in the folder is my pictures.

I want to be able to create a batch file to copy the images to a folder on my hard drive and put them in their date order.... Sounds pretty simple, but the file names are the same, and when I try to copy newer images from the camera to the same folder it recognises the same names and trys to overwrite them, so I need to either create a new folder or rename the older files.

Any help would be most grateful.....

Thanks
Dan
codejockey's Avatar
Senior Member with 1,410 posts.
 
Join Date: Feb 2002
07-Jul-2004, 02:43 AM #9
Motorfreak: have a look at http://forums.techguy.org/t175994 for two versions of a script that will extract elements of the system date and place them in environment variables (which can then be used by other batch files (or the same batch file) to create folders, etc.).

Hope this helps.
__________________
The slowest component still sits at the keyboard.
motorfreak's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2004
Experience: Intermediate
07-Jul-2004, 04:18 AM #10
Thanks Codejockey, will have a look.

I think I may have already sorted it out now. Where as you can download and rename the images to a dated folder, but if you download again on the same day it will overwrite still, so you have to do it on different days.

I will try this thread though.

Thanks again, you've been a good help.


Motorfreak.
guard's Avatar
Junior Member with 10 posts.
 
Join Date: Jun 2004
07-Jul-2004, 07:37 AM #11
You can use #LogDate and #LogTime to rename the files and to make date coded folders. See the examples at %.GetLogDate% and %.GetLogTime%.

These commands are in the FREE Advanced NT/2K/XP/K3 Command Library.
motorfreak's Avatar
Junior Member with 3 posts.
 
Join Date: Jun 2004
Experience: Intermediate
07-Jul-2004, 07:59 AM #12
thanks guard, will look into it.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:44 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.