When there is a folder called aaa
, all the files inside it (including all the files inside the folder) are
zzz
I want to move it to the folder, how should I use the command?
For example,
aaa_dir/a.png
aaa_dir/b.png
aaa_dir/bbb_dir/c.png
When you're like this
zzz_dir/a.png
zzz_dir/b.png
zzz_dir/c.png
I want to move it like this.
linux
If you want to equate the two directory structures, you can use the cp
and mv
commands.
But looking at the above question, it seems that you are trying to move it by ignoring the directory structure.
At the end, except for the mv
command, all of them are options for the find
command, so search.
You'll see the difference if you run the commands in order.
find aaa_dir (absolute or relative path) -name "*.png"
find aaa_dir -name "*.png" -printf "%f\n"
find aaa_dir -name "*.png" -printf "%f\n" -exec mv {} zzz_dir/ \;
© 2024 OneMinuteCode. All rights reserved.