Error on script to copy files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error on script to copy files
# 1  
Old 05-15-2013
Error on script to copy files

Hi

I have the following script to copy files from one directory to another:

Code:
#!/bin/sh
touch -mt 201304240000 /var/tmp/ref1
touch -mt 201305152359 /var/tmp/ref2
find /moneta_collected02/in_psl -type f \( -newer /var/tmp/ref1 -a ! -newer /var/tmp/ref2 \) > file_lst
cp -pr $(< file_lst) /moneta_collected02/in_psl1/

but when I run I have the following error:

Code:
root@moneta # ./transf
find: stat() error /moneta_collected02/in_psl/PSLCCN4-130106-0731-90574.gz: No such file or directory
./transf: syntax error at line 5: `(' unexpected

please can you help?
# 2  
Old 05-15-2013
are you sure below syntax is right?

Code:
 
cp -pr $(< file_lst)

# 3  
Old 05-15-2013
Error on script to copy files

I just want to copy files and preserve the permissions
# 4  
Old 05-15-2013
You are getting error from find command

find works by calling either ftw() or nftw() - these functions traverse a file tree, and return the results from a stat() call for every file found.

stat is a system call that returns metadata about a file - size, last modification date, permissions, etc. I/O errors occur when the filesystem metadata has a problem or the disk(s) has bad sectors, etc.

Is there any issues with PSLCCN4-130106-0731-90574.gz file?
# 5  
Old 05-15-2013
Error on script to copy files

that file do not exist

---------- Post updated at 11:50 AM ---------- Previous update was at 11:07 AM ----------

Please !

What could be wrong in that?
# 6  
Old 05-15-2013
I am not 100% certain.. Was that file removed recently? If yes it might happen that someone is still using that?
# 7  
Old 05-15-2013
Error on script to copy files

you could be right, because the application/database picks up files in there and moves it somewhere else. I may have to stop that stream
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

scp error while trying to copy files

Hi, I am trying to copy files from one server to other using the below code. scp -B -p user@remoteserver:/tmp/abc.txt /landing/files The above command is failing with error You're not allowed to run 'scp -p -f /tmp/abc.txt ' When I am using scp -B -p , why am I getting error msg as scp... (2 Replies)
Discussion started by: Nikhath
2 Replies

2. UNIX for Dummies Questions & Answers

Script to search and copy files

HI everyone, I been to this site before for help and found my answers on other threads now I am posting my own :). I have a list of file names with out extensions on an txt file. I need a way for the script to search on the server for each file name and copy the files over to a new directory.... (12 Replies)
Discussion started by: sergiol
12 Replies

3. UNIX for Dummies Questions & Answers

Script to copy files from a certain date

I need to copy files from a directory that has a lot of files in it. However I only want to copy them from a certain date. My thoughts so far are to use ls -l and to pipe this into awk and print out tokens 6 (month)and 7 (day). $ ls -l -rw-r--r-- 1 prodqual tst 681883 Jun 12... (2 Replies)
Discussion started by: millsy5
2 Replies

4. Shell Programming and Scripting

Copy Files with script

Hello, I have written a script to copy files from one partion to another. Not sure if this is correct. #!/bin/sh CDR_SOURCE=/storage/archive/logmgmt/result/billing/ CDR_DEST=/storage4/archive/logmgmt/result/billing/ cp $CDR_SOURCE $CDR_DEST; exit 0 The CDR_SOURCE folder has... (5 Replies)
Discussion started by: Siddheshk
5 Replies

5. Shell Programming and Scripting

bash script to copy files

hey everyone, new here i have arch setup and i am using smbnetfs to mount some windows shares in /mnt/smbnet what i want to do is copy files from my home dir to a dir in /mnt/smbnet but i also need it to remove files if i have deleted them from my home dir seems that cp would be the... (8 Replies)
Discussion started by: dodgefan67
8 Replies

6. Shell Programming and Scripting

Script to Poll Directory and Copy files

Hi all, I'm looking for a script to poll a specified directory and copy new files to another location. The script should only copy new files so, I based on mtime I guess? Can anyone point me in the right direction of a script which could do this? My scripting skills aren't too bad, but... (1 Reply)
Discussion started by: JayC89
1 Replies

7. Shell Programming and Scripting

error in sh script while copy files to a backup directory

I am trying to copy files from one directory to another using shell script. Can anyone please troubleshoot the code. thanks in advance... #!C:\Shell\sh.exe files_dir="C:\Documents and Settings\scripts\files" backup_dir="C:\Documents and Settings\scripts\ztest" echo cding to... (2 Replies)
Discussion started by: sureshcisco
2 Replies

8. Shell Programming and Scripting

Need a script to copy files and check

Hi all, I need a script in ksh: 1: Copy files from directory (A) to directory (B) 2: Check if files that will be copied in directory (A) have never been yet copied to (B) 3: Never copy the last created file of directory (A) This script will run on crontab. Thanks in advance for your... (1 Reply)
Discussion started by: Camaro
1 Replies

9. Shell Programming and Scripting

Trying to copy a TON of files with a script

Ok, here's the problem. I need to copy about 200 GB from an old FreeBSD (5.2.1) server to a new Debian server. The old server's fastest port is the ethernet port. I set up an NFS server on the new machine so I can just copy the files over using regular commands/scripts etc. Thing is, I probably... (4 Replies)
Discussion started by: davidstvz
4 Replies

10. Shell Programming and Scripting

copy files without password in script

1. I wrote a ftp code to copy a file from unix box to another unix box. But it has clear text password in the code. Due to security constraints, clear text password in the code is not allowed. Please let me know the ways to write the code without prompting for password. 2. I tried writing scp... (0 Replies)
Discussion started by: jwala
0 Replies
Login or Register to Ask a Question