Article 525M3 Copy files by skipping parent directory

Copy files by skipping parent directory

by
Dman58
from LinuxQuestions.org on (#525M3)
Hi I'm trying to copy a large list of files from a directory. The directory format is as follows.
Code:Folder-
Parent-
Subfolder-
files to copy
Parent-
Subfolder-
files to copy
Parent-
Subfolder-
files to copyWhat I want is the subfolder and its contents skipping over the parent directory. I believe I need to use either some Regex or some kind of find command solution. I have tried the following with all kinds of various output.

This seems to be a good starting point, it shows the directories I want to begin with but when I try to pipe it into copy it seems to not like the syntax
Code:find /tmp/box1 -maxdepth 2This semi worked but files were copied into wrong locations:
Code:find /tmp/box1 -maxdepth 2 | xargs cp -R /tmp/box2Not working
Code:find /tmp/box1 -maxdepth 2 -type f -print0 | xargs cp -R /tmp/box2latest?d=yIl2AUoC8zA latest?i=Q1Hx8VXegFs:XdZHPO6bZc4:F7zBnMy latest?i=Q1Hx8VXegFs:XdZHPO6bZc4:V_sGLiP latest?d=qj6IDK7rITs latest?i=Q1Hx8VXegFs:XdZHPO6bZc4:gIN9vFwQ1Hx8VXegFs
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments