I am trying to copy files and the directory it is in to another location. I can find the path like this:
find ~/dim_import/* -type f ! -name xdir | cut -d '/' -f 5-10
which outputs
general/header.txt
scripts/test
scripts/tt
How do I copy these to another location? For example the new location would be
new/general/header.txt
new/scripts/test
new/scripts/tt
The issue is that there are more directories that are empty and I do not want to copy those, only the directories that have files in them and the files themselves.
NOTE: not using bash, using sh
.