Monday, April 29, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 638  / 1 Year ago, sat, april 1, 2023, 2:21:32

I want to copy all the files that I have in the system with extension sol to the specific folder
can you please help me.
I tried sudo cp / *.sol ~/SOL/
but it doesn't work


UPDATED:


I tried to follow the first answer, and that's what I got:


root@johntheripper-PORTEGE-Z835:~# find / -name *.sol | wc -l
61
root@johntheripper-PORTEGE-Z835:~# find / -type f -name '*.sol' -exec cp {} ~/SOL ;
...
...
...
root@johntheripper-PORTEGE-Z835:~# find ~/SOL -name *.sol | wc -l
26

As you can see 26 out of 61 file was copied, please help me to copy the rest.


More From » command-line

 Answers
4


There's a bash script to copy files with specific extension in this link.



There's also an answer on StackOverflow, I haven't tested it yet, but here it is:



find / -type f -name '*.sol' -exec cp '{}' ~/SOL ;


EDIT: As phoibos suggested, I changed the answer adding '' in the code.


[#34942] Sunday, April 2, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
;