LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How find file name by pattern to immediately use it again for the next time (https://www.linuxquestions.org/questions/programming-9/how-find-file-name-by-pattern-to-immediately-use-it-again-for-the-next-time-4175718777/)

BudiKusasi 11-14-2022 05:15 PM

How find file name by pattern to immediately use it again for the next time
 
How do we find file names by pattern to use them, for copy/move or delete etc, again for the next time in one line CLI, e.g.
Code:

$ ls

.hello-577
.world-999
.foo-444
jjj
hello
world
foo
kkk
lll

so must get all .hello-577 .world-999 .foo-444 hello world foo to use them in the operation said

e.g. there's BAK directory so as if copy operation:
Code:

cp .hello-577 .world-999 .foo-444 hello world foo BAK
e.g. they're removed so as if operating:
Code:

rm .hello-577 .world-999 .foo-444 hello world foo
Please sincere help is invaluable

dugan 11-14-2022 06:42 PM

The standard answer would be find -exec.

NevemTeve 11-15-2022 12:26 AM

@OP Where is the pattern?

grail 11-15-2022 04:06 AM

As usual, what have you tried and where are you stuck?

rtmistler 11-15-2022 09:10 AM

This is from one of the LQ FAQs and would prove to be very helpful for you:

http://www.catb.org/~esr/faqs/smart-questions.html


All times are GMT -5. The time now is 07:55 AM.