10 lines
352 B
Bash
Executable File
10 lines
352 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Define output file name
|
|
input_dir="$1"
|
|
output_file="$2"
|
|
# Find all directories in root and write to file
|
|
# Using find to list only directories (-type d) at depth 1 (-maxdepth 1)
|
|
find $input_dir -maxdepth 1 -type d -not -path "$input_dir" -exec basename {} \; | sort >> "$output_file"
|
|
|
|
echo "Folder list has been written to $output_file" |