Is there a way to copy a list of files, that share a common base directory, preserving their relative directory structure? The files with relative paths are listed in a text file. edit I have the filenames listed in a plain text file.
I'd like to do this without using a script (no bash/batch/python/ruby/lua/etc.), similar to how wget -i
works for urls. (My reason is that it'd give overhead/non-standard solution for a reasonably common task.)
I've tried cat list.txt | xargs -I % cp % new_folder
from Copy list of files but it didn't preserve the relative directory path.
I'd do this to export my selection of files (that I already have in a text file) from a directory structure that has big number of files (happens from time to time).