Why when I do this (I know, it's stupid) it returns the full path, not only the filename as expected?
ls -l | awk '{print $9}' | xargs -I% find ./my_dir -type f -name "%" -exec echo $(basename {}) \;
And, yes, I know, it's stupid but the goal was to cp basename{} to {} (and, in the and, I use a loop for i in $(ls); do find ./my_dir -type f -name $i -exec cp $i {} \;; done
)
Thanks.
Asked by Alysko
(103 rep)
Aug 2, 2022, 01:15 PM
Last activity: Aug 3, 2022, 08:14 PM
Last activity: Aug 3, 2022, 08:14 PM