For example, I use find
command find /usr/share/icons -iname 'foxitreader*'
find the files:
/usr/share/icons/hicolor/32x32/apps/FoxitReader.png
/usr/share/icons/hicolor/48x48/apps/FoxitReader.png
/usr/share/icons/hicolor/64x64/apps/FoxitReader.png
/usr/share/icons/hicolor/128x128/apps/FoxitReader.png
/usr/share/icons/hicolor/16x16/apps/FoxitReader.png
and I want to use xargs
copy them to the .local/share/icons/
, and in the icons
directory has the same subdirectory structure, which is:
└── hicolor
├── 16x16
│ └── apps
│ ├── 1B94_WScript.0.png
│ ├── 1CD8_rundll32.0.png
│ ├── 1E64_notepad.0.png
│ ├── 2402_msiexec.0.png
│
├── 24x24
│ └── apps
│ ├── 6C56_Timwp.0.png
│ └── FoxitReader.png
├── 256x256
│ └── apps
│ ├── 1E64_notepad.0.png
│ ├── 2402_msiexec.0.png
│ ├── 2EF4_wordpad.0.png
├── 32x32
│ └── apps
│ ├── 1B94_WScript.0.png
│ ├── 1CD8_rundll32.0.png
│ ├── 1E64_notepad.0.png
└── 48x48
└── apps
├── 1CD8_rundll32.0.png
├── 1E64_notepad.0.png
├── 2402_msiexec.0.png
and I just want to copy the files I find, not the whole directory structure, so how can I copy these files to the corresponding directory, like this:
/usr/share/icons/hicolor/32x32/apps/FoxitReader.png
to the .local/share/icons/32x32/apps/FoxitReader.png
, etc.
And the icons
directory already have these subdirectories, and it's not empty, so you can't just use cp
to merge them, and I use find
to find the files, and want to use xargs
to copy them once a time, not more times manually.
cp
commands, and I have used the command for a while, what I want to know is a specific problem to thecp
command, maybe there is my terrible description confusing you. I want to usefind
andxargs
command to copy the files once a time, not more times.