Linux combine find and copy commands
https://blog.softhints.com/linux-comb...
copy all jpg files to folder /home/newteam/
find . -type f -name "*.jpg" -exec cp {} /home/newteam/ ';'
copy text files to folder on the same level as Team
find . -type f -name "*.jpg" -exec cp {} ../newteam/ ';'
Find text files in folder /home/pictures/ and copy them to folder on the same level as Team
find /home/pictures/ -type f -name "*.jpg" -exec cp {} ../newteam/ ';'
Explanation:
find: invoking the find command
.: start search from current working directory.
/home/pictures/ - search in a given folder
Since no depth flags are specified, this will search recursively for all subfolders
-type f -name "*.jpg": find files with the given extension
-exec: for the every result of find command, do a copy to another folder
{}: the result of find command will be replaced here.
';': it is used to separate different commands to be run after find
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store
https://bitbucket.org/softhints/
Socials
Facebook: / 435421910242028
Facebook: / softhints
Twitter: / softwarehints
Discord: / discord
If you really find this channel useful and enjoy the content, you're welcome to support me and this channel with a small donation via PayPal and Bitcoin.
PayPal donation https://www.paypal.me/fantasyan