Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

clilly

macrumors newbie
Original poster
Jan 23, 2023
9
1
Hello, I need to create multiple files with numbers as the names on a regular basis. So, for example, one day I would need to create folders 1000-1100, the next day 1100-1150, the following day 1150-1200, and so on. Can I use applescript for this? Or is there another method/app that anyone recommends?
 

kryten2

macrumors 65816
Mar 17, 2012
1,114
99
Belgium
Your shell whatever that may be might be useful.
Example:
Bash:
for i in {1000..1100}; do mkdir $i; done
 

Nygaard

macrumors member
Dec 7, 2022
47
20
Houston
You can also schedule a cron job to execute this script on a periodic basis.

It really depends on your use case and what you are creating all these folders for. What are you ultimately trying to accomplish?
 

clilly

macrumors newbie
Original poster
Jan 23, 2023
9
1
You can also schedule a cron job to execute this script on a periodic basis.

It really depends on your use case and what you are creating all these folders for. What are you ultimately trying to accomplish?
Each file is for all media/information relating to a specific item I sell. The numbers that I label each folder with are an identifying number for each item. So, for example, folder "1015" holds everything for item# 1015. I need to create about 1,000 folders over the next few weeks, so it will save a lot of time if I can create the folders quickly in batches for the items I am working on that day.
 

casperes1996

macrumors 604
Jan 26, 2014
7,434
5,578
Horsens, Denmark
Each file is for all media/information relating to a specific item I sell. The numbers that I label each folder with are an identifying number for each item. So, for example, folder "1015" holds everything for item# 1015. I need to create about 1,000 folders over the next few weeks, so it will save a lot of time if I can create the folders quickly in batches for the items I am working on that day.
Make this file

Code:
#!/bin/bash
for i in {$1..$2}; do mkdir $i; done

Save it as whatever you'd like. I'll consider it to be named dir.sh for the rest of this. Make sure it is plain text (write in TextEdit in Plain text mode or through Terminal with nano

Now make it executable with
chmod +x dir.sh

Now you can run it like
./dir.sh 100 1000

and it will make folders from 100 to 1000. Use whatever numbers you prefer
 
  • Like
Reactions: kryten2
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.