Monday, February 29, 2016

How to copy files/directories from list preserving directory


Create a directory 'newdir',
And run the following supplying the filelist file:


You have the following tree as in example:

Now, you have the following list of files inside `filelist.txt`:

You want to copy somewhere else only this files.
The script should run inside the `dir0` directory.
The above script will run on each row inside filelist.txt and copy them to `newdir`. `newdir` should be created before running the script.

* It does not matter if the end path is a file or directory