Visit Our UNIX and Linux User Community


getting error while copying files


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users getting error while copying files
# 1  
Old 09-29-2008
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
# 2  
Old 09-29-2008
You are missing a ";" in the statement. Here is another example of find and exec together.

Code:
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.

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

# 3  
Old 09-29-2008
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
# 4  
Old 09-29-2008
I tried with this command, and works like a charm..



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

# 5  
Old 09-29-2008
Hi
Thanks its working fine.I want to replace control m charactres current dir and all subdirectories as well.Please help

Thanks,
Akil
# 6  
Old 09-29-2008
Following are the solutions for this :

Code:
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.
# 7  
Old 09-29-2008
Hi
Thanks ,its working fine

Thanks,
Akil

Previous Thread | Next Thread
Test Your Knowledge in Computers #612
Difficulty: Medium
In Python, they are five numeric types - integers, long integers, floating point, infinite, and complex numbers.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copying files

All, I need to grab and rename common files from several unique directory structures. For example, the directory structures looks like: /unique_dir/common/common/common/person_name_dir/common_file.txt There are over 90,000 of these text files that I'd like to put in a single directory as... (5 Replies)
Discussion started by: hburnswell
5 Replies

2. Solaris

Error copying files

I have installed Solaris 10 on a Sunblade 150 (512 MB RAM) successfully. But when I create a new directory and try to copy a 40 MB file to it it stops after about 37 MB and gives an error "I/O error" while copying. I have 40GB of Hard Disk. What is the problem? (8 Replies)
Discussion started by: mickod
8 Replies

3. Shell Programming and Scripting

Files copying - [ Listed files alone. ] - Shell script

Hi All, I am doing this for svn patch making. I got the list of files to make the patch. I have the list in a file with path of all the files. To Do From Directory : /myproject/MainDir To Directory : /myproject/data List of files need to copy is in the file: /myproject/filesList.txt ... (4 Replies)
Discussion started by: linuxadmin
4 Replies

4. Shell Programming and Scripting

Error copying files from Unix (Solaris10) to Windows Server 2003 using scp/sftp

Hi, I have generated a Public/Private Key Pair in Solaris Unix (source) server and deployed the Public key in Windows 2003(target) server .ssh directory of user profile. When i try to connect(ssh, scp, sftp) from Unix, i'm getting below error message. Sun_SSH_1.1, SSH protocols 1.5/2.0,... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

5. UNIX for Dummies Questions & Answers

No such file or directory error while copying files

Hi, I need to copy files from one dir to another dir. The list of filesnames to be moved are in a file called files2cp.log Script: #!/bin/ksh exec 0</home/amdocs/files2cp.log while read LINE do cp -i /iccs33/attach/"$LINE" /iccs30/attach/"$LINE" done The output is "No such... (6 Replies)
Discussion started by: srinirsr
6 Replies

6. UNIX for Advanced & Expert Users

copying of files by userB, dir & files owned by userA

I am userB and have a dir /temp1 This dir is owned by me. How do I recursively copy files from another users's dir userA? I need to preserve the original user who created files, original group information, original create date, mod date etc. I tried cp -pr /home/userA/* . ... (2 Replies)
Discussion started by: Hangman2
2 Replies

7. UNIX for Dummies Questions & Answers

Shell Syntax Error when copying files

Hello, I apologize if this was addressed in a previous post. I have done some searching but may have missed it. I am trying to read a list from a file, for example: 3bik 3bix 3biu 3bin 1nwn and using this list, copy files with these names (ex: 3bik.dssp.Z) to a seperate folder,... (1 Reply)
Discussion started by: InfoSeeker
1 Replies

8. Shell Programming and Scripting

copying files

hi I want to copy all files from the current directory and move to .archive file. Moreover,I want to add .bak to each file name, that will be copied. How can I do that? (4 Replies)
Discussion started by: tjay83
4 Replies

9. Solaris

Copying Files and

I am new user to solaris and installed solaris operating system on full Harddisk 120Gb. I am unable to copy music files to desktop and /home directory. One thing happened while registering is- i entered login-root and its password. The message prompted your system is crashed. Is it because of... (1 Reply)
Discussion started by: patilmukundraj
1 Replies

10. UNIX for Dummies Questions & Answers

Copying files

I like to know the command structure of copying files/directories from a unix box using telnet session to a windows box. (4 Replies)
Discussion started by: alpheusm
4 Replies

Featured Tech Videos