I was just given the task to create a new folder on box for about 500 clients. Python is the only code I am familiar with, but I am willing to use another language as well. I have a list of each clients name in excel and would like to create a new folder for each name if possible with sub-categories (ex. Illustrations, Advice, and Meeting Notes). I will then put all of those in a folder and upload that one big folder to box. If anyone can help please let me know
Asked
Active
Viewed 56 times
0
-
3Please paste what you have already tried, this is not a code-writing service. – Anand S Kumar Jul 06 '15 at 15:07
-
Can you show what you already tried yourself? – Timo Jul 06 '15 at 15:08
-
1Read the docs on both the `os` and `csv` modules. – SuperBiasedMan Jul 06 '15 at 15:13
1 Answers
0
As mentioned, you should investigate the csv
library, but if this is a one off operation, and seeing as there are only 500 clients, it might be simpler just to copy paste your 500 clients into the following script:
import os
names = """
Adam Adams
Betty Bo
Carl Carter
Denise & David Daniels"""
sub_categories = ["Illustrations", "Advice", "Meeting Notes"]
root_folder = "c:/clients"
for name in names.split("\n"):
# Sanitise the name (remove any extra leading or trailing spaces)
name = name.strip()
# Skip any blank lines
if name:
# Remove some illegal characters from the name (could be done using RegEx)
for item in ["&", "/", "\\", ":"]:
name = name.replace(item, " ") # Convert to spaces
name = name.replace(" ", "") # Remove any double spaces
# Create all the folders for this client name
for sub_category in sub_categories:
os.makedirs("%s/%s/%s" % (root_folder, name, sub_category))
Tested in Python 2.7

Martin Evans
- 45,791
- 17
- 81
- 97