getting error while copying files

I am trying copy all files ,i was getting below error .Please any idea

#find . -name "*bat" -exec cp -p {} /devt/jobs
find: incomplete statement

Thanks,
Akil

You are missing a ";" in the statement. Here is another example of find and exec together.

find /usr/include -type f -exec grep NFS_VERSION {} \; -print

Also, instead of using this command, I would suggest you to use find| xargs command. Following is the example.

find /usr/include -type f|xargs grep NFS_VERSION

Hi

I want to copy files from home to /devt/jobs and just want to check with u on the below one

find /usr/include -type f|xargs grep NFS_VERSION--This is destination folder

Thanks,
Akil

I tried with this command, and works like a charm..

find <start directory> -iname "<all my files type>" -exec cp {} <target_dir> \;

Hi
Thanks its working fine.I want to replace control m charactres current dir and all subdirectories as well.Please help

Thanks,
Akil

Following are the solutions for this :

sed 's/^M//g' ${INPUT_FILE} > tmp.txt
mv  tmp.txt  ${INPUT_FILE}


tr -d "\15"  < ${INPUT_FILE} >  tmp.txt;
mv  tmp.txt  ${INPUT_FILE}


for file in $(find /path/to/dir -type f); do
   tr -d '\r' <$file >temp.$$ && mv temp.$$ $file
done

Feel free to choose your option.If it's a DOS file, check out the command dos2unix.

Hi
Thanks ,its working fine

Thanks,
Akil

Hi
I want to remove all files which i copied .I tried the below one its not working

find <start directory> -name "<all my files type>" -exec rm -f {}

Thanks,
Akil

Hi nau,

when execute the below one ,its copying all files as well as subfolder files to target folder .I want to copy all files and sub directories to target folder.

find <start directory> -iname "<all my files type>" -exec cp {} <target_dir> \;

Thanks in advance
MR

If your cp understands the -r option, use that. Or run tar or cpio to copy a directory structure.