bash - Recursively copy user-executable files -
how can recursively copy user-executable files in folder folder?
example, have
in folder folder/one
:
-rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable1 -rw-rw-r-- 1 user group 4444 jun 1 12:00 text1.txt
in folder folder/two
:
-rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable2 -rw-rw-r-- 1 user group 4444 jun 1 12:00 text2.txt
it should recursively copy executable1
, executable2
folder
destination folder without preserving original hierarchy.
destination folder should have:
-rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable2 -rwxrwxr-x 1 user group 7777777 jun 1 12:00 executable1
you use find command:
find folder -type f -executable -exec echo "{}" /tmp \;
replace echo
cp -p
after verify output correct.
Comments
Post a Comment