I have a file (say called list.txt) that contains relative paths to files, one path per line, i.e. something like this:
list.txt
foo/bar/file1 foo/bar/ba
Great solution from this source
p=/foo/bar/file1 path=$( echo ${p%/*} ) file=$( echo ${p##/*/} )
This also works with spaces in the path!