I have multiple directories with a few thousand files each. Each directory contains files with the same names, but with different extensions.
I would like to move x
files each from these sets of directories to another set of directories, such that the same file names, except the extension, are moved from each directory. Which files are moved do not matter to me.
For example, if I have directories A/
, B/
, and C/
, each with 1000 files, and I have another set P/
, Q/
, R/
, and say x
is 100, I would like to copy 100 files from A
to P
, B
to Q
, C
to R
, such that the files copied have the exact same name, except the extension.
I have seen the following questions and their answers:
- Copy first n files in a different directory
- How to move the first x files
- How to move 100 files from a folder containing thousands?
However, each deals with copying any x
files. I tried using find
as suggested, and found that different files were being copied from different directories.
How can I do this?
Thank you.