Bulk provision Personal folders based on information from an input csv file
We have a need to create a folder with the users names in the root of their Box account. We have the correct information needed in a csv file with parentID, name and UserID. We were provided a sample bash script that uses the Box CLI and calls on the command "box folders:create $parentID $name --as-user=$uid". Unfortunately it isn't working correctly and it's failing. It's complaining about "line 3: $'{\r': command not found". I am not a developer or programmer and I've spent the past couple of days trying to figure out what is wrong. Can someone please explain to me in the simplest terms what I need to do to get this script to work correctly so we can create a folder in root of each users Box account. Thanks in advance for the support.
Sample Bash Script -
INPUT_USER_LIST="[InputFile.csv]"
# Input file with three columns: parent ID (will always be 0), name (folder name to create), User ID
{
read # Skip the header row
while IFS=, read -r parentID name uid
do
echo "Running for user $name -- $uid"
# Create the personal folder
box folders:create $parentID $name --as-user=$uid
done
} < $INPUT_USER_LIST
-
Sounds like a syntax error in the script. From your comment, it's breaking a the "r" of "read" and trying to run that as a command. There is no command called "r" so it ends and says "command not found".
We do a similar thing with a python script and the Box Python SDK. It's a lot of checking for folders, verifying owners, changing owners if necessary, etc. It works though. We also put all of our user data in a service account and then share with the user as co-owners. This way the data is all in one place, easily reported, links/collaborations stay alive if the account is deleted.
サインインしてコメントを残してください。
コメント
1件のコメント