My bash fu is not what it should be.
I want to create a little batch script which will copy a list of directories into a new zip file.
There are (at least) t
Just use the null-byte as delimiter when you write file / directory names to file. This way you need not worry about spaces, newlines, etc. in file names!
printf "%s\000" */ > listOfDirs.txt # alternative: find ... -print0
while IFS="" read -r -d '' dir; do command ls -1abd "$dir"; done < listOfDirs.txt
tar --null -czvf mytar.tar.gz --files-from listOfDirs.txt