LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2003, 01:58 PM   #1
MadClouds
LQ Newbie
 
Registered: Nov 2003
Posts: 1

Rep: Reputation: 0
A script to make folders...


Hey everyone,

i am new to scripting (just starting off infact) and i was curious in the process of making a batch file that would make folders named "1" to "100".

How would this be done??
My guess is it would look something like:

mkdir "1" +1;
if dir=100 stop (some sort of test)

else go back to top


seems like quite an easy script... but for having NO scripting experiance... any help is greatly taken

Thanks!!!
MC
 
Old 11-24-2003, 02:06 PM   #2
Khabi
Member
 
Registered: Aug 2003
Location: Arizona
Distribution: Gentoo
Posts: 142

Rep: Reputation: 15
this will do it.

Code:
#!/bin/bash

var=1
LIMIT=101

while [ $var != $LIMIT ]
do
  mkdir "$var"
  var=$(($var+1))
done

exit 0
 
Old 11-26-2003, 08:39 PM   #3
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
Another possibility.

num=0
until (( $num > 99 ))
do
let num+=1
mkdir "$num"
done

Last edited by /bin/bash; 11-26-2003 at 08:40 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make folders cegha Mandriva 1 07-18-2005 05:25 PM
Delete old files and folders Script? AsteX Linux - General 4 11-11-2004 06:26 PM
Program to make folders transparent? Kami.JZ Linux - Software 2 11-11-2004 02:15 AM
Helpwriting a script that tar's multiple scripts in all folders but not itself VisionZ Linux - Newbie 2 03-22-2004 03:49 AM
need a perl script to remove folders cccc Programming 5 03-12-2004 02:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration