Unix How to combine find and cp

Hi ,i want to find sertain files and copy them with cp in current folder

find -command -exec cp -command  {} \; 

Thanks ,how can I do
find ./ -name "*.c" -size 10
cp here(directory)

find ./ -name "*.c" -size 10 -exec cp . {} \;
find ./ -name "*.c" -size 10 | xargs cp .

alternative

Thanks
can I specified the destination

Before asking give it a try. You'll learn better by experimenting. Just don't experiment with rm or mv. Replace the " . " at the end with the desired destination. The period just means "the directory I'm currently in"

I did ,and then ask again :wall:

find ./ -name "*.csh" -size 10 | xargs cp ./
find ./ -name "*.csh" -size 1 -exec cp ./tova.bac {} \

Thanks

tova.bac is the directory name? And it's a subdirectory of the directory you are currently in? If not that won't work. You need a semicolon ; after that last back slash. \;

I tried this to but didnt work
nova is directory:wall:

 
find ./ -name "*.csh" -size 1 | xargs cp ./nova

 

Is nova a subdirectory of the directory you're currently in? The period means "in the directory I'm currently in". So "./nova" means nova is a subdirectory of the directory your shell prompt is currently in. You can find your current directory by typing 'pwd' at the prompt. Might want to specify the full path of the destination directory...

I am trying this nova is subdirectory to the directory I am in
it prints
cp: Insufficient arguments (1)

 
find ./ -name "*.csh" -size 1 -exec cp ./nova {}\;

 
find . -type f -name "*.csh" | xargs cp ./nova

Does this work for you?

Another question ,how can I add to all files in sertain directory extention to the name file1,file2
file1.exe,file2.exe
I tried this but it doesn work

 
sed s\"  "\.exe\ directory

You can just 'mv' a file so example

mv foo.txt foo.old

Would rename foo.txt to foo.old. Lol ooops you said to all files. Give me a second to get home, I'm driving

No it doesnt work it gives me that .csh must be directory ,do you think that I should switch the order

---------- Post updated at 09:32 PM ---------- Previous update was at 09:30 PM ----------

I have to put extation on 50 files in directory,move its not gona work :frowning:

it shouldn't say that .csh must be a directory, we specified ' -type f ' meaning it's a file not a directory. Make sure you type in the command exactly or just copy and paste if your shell allows it. If you specified ' -type d ' then it would be looking for a directory.