Skip to content

Instantly share code, notes, and snippets.

@manero6
Last active September 28, 2023 15:53
Show Gist options
  • Save manero6/2036905d4f68056dbb89bd5d089bbe78 to your computer and use it in GitHub Desktop.
Save manero6/2036905d4f68056dbb89bd5d089bbe78 to your computer and use it in GitHub Desktop.
Bash script to create a formatted list to be used when concatenating with FFmpeg
#!/bin/bash
if [ $# = 1 ]
then
LIST=`ls | grep -i "$1" | sed -e "s/^/file '/" -e "s/$/'/"`
if [[ -f list ]]
then
read -p "Do you want to overwrite the already existing 'list' file? (y/N) " yn
case $yn in
[yY]* ) echo -e "\nOverwriting already existing 'list' file with the following content:\n"
echo "$LIST"
echo
echo "$LIST" > list
;;
* ) echo -e "\nExiting...\n"
exit
;;
esac
else
echo -e "\nCreating \"list\" file with the following content:\n"
echo "$LIST"
echo
echo "$LIST" > list
fi
else
echo ERROR: One argument must be given
echo
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment