0

I want to copy all the final files from parent folder and child folders to a different folder. How to do that?

  • I believe you need to rewrite the question a bit, no idea what you mean. – Jacob Vlijm Feb 10 at 9:43
  • cp -p /path/final_files\* /path/subpath/ -- but you'll need to adjust as your question is unclear. I use the -p to preserve file attributes (mode, ownership, timestamps) assuming you want to keep this. – guiverc Feb 10 at 10:07
  • You want to make a directory with a flat structure containing the files from a multi-level structure, I think? – Zanna Feb 11 at 21:21
2

What I understood is that you want to copy all files from a folder which has sub-folders to a destination folder.

You can use:

find source_directory -type f -exec cp -t destination_folder "{}" \+

Or you can just use the copy command as suggested in the comments like:

cp -p source_directory/* destination_directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.