M
M
m00nkey2014-08-15 09:38:33
bash
m00nkey, 2014-08-15 09:38:33

How to write a bash script to search and copy files?

Greetings!
There is a file filename123.txt, I need to search 500 directories for filename123.exe, and if such a file exists, then copy it to filename123.txt
, now let's say I have a directory in which:
filename123.txt.
filenameAD.txt
...
1filename.txt
B I need to do such a search for each. Can you give me some hints on how to do this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Kiselev, 2014-08-15
@m00nkey

I'm assuming that since you're asking this question, you're not familiar enough with the capabilities of the find command. I offer you not just a help for this command, but a whole service , for those who have not yet memorized the parameters.

S
Sergey, 2014-08-15
@bk0011m

Why a script when one command is enough: find ??

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question