A script for macos that creates and names individual folders from a .txt file containing the list of names of these; place these dynamically named subfolders in the /Users/shared directory and name the parent folder: subfolders followed by the timestamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# a script for macos that creates and names individual folders from a .txt file containing the list of names of these; place these dynamically named subfolders in the /Users/shared directory and name the parent folder: subfolders followed by the timestamp | |
# Get the current timestamp | |
timestamp=$(date "+%Y.%m.%d-%H.%M.%S") | |
# Define the parent directory path | |
parent_dir="/Users/Shared/subfolders_$timestamp" | |
# Create the parent directory | |
mkdir "$parent_dir" | |
# Iterate over each line in the file | |
while IFS= read -r line | |
do | |
# Create a new directory for each line in the file | |
mkdir "$parent_dir/$line" | |
done < 'file.txt' |