You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
509 B
19 lines
509 B
2 years ago
|
#!/bin/bash
|
||
|
|
||
|
# Check that a folder path was provided as an argument
|
||
|
if [ "$#" -ne 1 ]; then
|
||
|
echo "Error: Please provide a folder path as an argument."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Create a text file with the same name as the folder
|
||
|
folder_name=$(basename "$1")
|
||
|
text_file="$folder_name.txt"
|
||
|
|
||
|
# Read all the filenames in the folder and put them in the text file
|
||
|
# Todo: Remove the folder/ name from before the filename
|
||
|
for filename in "$1"/*; do
|
||
|
echo "$filename" >> "$text_file"
|
||
|
done
|
||
|
|
||
|
echo "Text file created: $text_file"
|