The below bash is trying to list the folders in a specific directory. It seems close but adds the path to the filename, which basename could strip off I think, but not sure why it writes the text file created? This list of folders in the directory will be used later, but needs to only be the folder names. Thank you :).
Bash
#!/bin/bash
dir="/home/cmccabe/Desktop/tetsfolder/"
for file in ${dir}/*
do
echo "$file"
done > /home/cmccabe/Desktop/tetsfolder/list
#!/bin/bash
dir="/home/cmccabe/Desktop/tetsfolder/"
for file in ${dir}/*/
do
file="${file%%/}"
echo "${file##.*/}"
done > /home/cmccabe/Desktop/tetsfolder/list