I have a text file containing a list of files like:
Code:
/etc/modprobe.d/blacklist.conf
/etc/rsyslog.d/50-default.conf
/etc/ufw/ufw.conf
/lib/bootchart/gather
/lib/resolvconf/list-records
/usr/lib/php5/20060613+lfs/gd.so
/usr/lib/php5/20060613+lfs/pdo.so
How would I copy them to a target directory while keeping the directory hierarchy intact?
I can't do
Code:
for file in list: cp file target
because that would put all files in the target directory.
I also cannot do
Code:
for file in list: cp file target/file
because direcotries like /etc or /usr/lib/php5 don't exist.
Any help is appreciated, TIA!
Bookmarks