How to check file is being copied


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to check file is being copied
# 1  
Old 06-05-2008
How to check file is being copied

I wanna check whether a file is being copied ,i.e the file size is increasing.
Thanks for your help
# 2  
Old 06-05-2008
a=`wc -c filename1 | nawk '{print $1}` b=`wc -c filename2 | nawk '{print $1}'`
if [[ $a -eq $b ]]; then
echo "File sizes match."
else
echo "File sizes differ! "
# 3  
Old 06-06-2008
Or maybe more like

Code:
set -- `ls -l "$file"`
size=$5
while true; do
  sleep 60
  set -- `ls -l "$file"`
  case $5 in $size) break;; esac
  size=$5
done

This will loop until the size of the file stays the same for 60 seconds. (You will need to set the variable file to the name of the file you want to monitor, of course.)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wait for file to get copied in server path and then proceed

Hi, I have a requirement to create below script: Script must run infinitely in background. It will check a particular type of file to be copied in specific folder of server Script must wait till any file gets fully copied ..(important) and then It will read that file Experts please... (4 Replies)
Discussion started by: Vikash163
4 Replies

2. Red Hat

Difference in file sizes being copied by scp. HELP!

Hello All, I am transfering a gzipped file from LINUX to LINUX using scp -C comand. It is a nightly job, called by crontab. After copy finishes, the file sizes are different between source and destination. Say .gz file is 14782805941 bytes on source and 13496172544 bytes on destination. When I... (20 Replies)
Discussion started by: NotALinuxGirl
20 Replies

3. Shell Programming and Scripting

Check files copied from remote server

There is a process which copy files form unix a to unix b I would like to check whether all files copied from a to b or not ,and list which are the missing files. Is there a command to check like that (3 Replies)
Discussion started by: lalitpct
3 Replies

4. Shell Programming and Scripting

Extract a number from a line in a file and sed in another copied file

Dear all, I am trying to extract a number from a line in one file (task 1), duplicate another file (task 2) and replace all instances of the strings 300, in duplicated with the extracted number (task 3). Here is what I have tried so far: for ((k=1;k<4;k++)); do temp=`sed -n "${k}p"... (2 Replies)
Discussion started by: mnaqvi
2 Replies

5. UNIX for Advanced & Expert Users

Check EOF char in Unix. OR To check file has been received completely from a remote system

Advance Thanks. (1) I would like to know any unix/Linux command to check EOF char in a file. (2) Or Any way I can check a file has been reached completely at machine B from machine A. Note that machine A ftp/scp the file to machine B at unknown time. (5 Replies)
Discussion started by: alexalex1
5 Replies

6. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

7. Solaris

Check copied file

Hi all, If i wanted to copy file within different folders or different servers, how do i determine the copied file is absolutely correct :confused: Is it using cmp and chksum command enough? Anyway that i can make further checking? Thanks in advance for reading & anyone who reply the... (7 Replies)
Discussion started by: beginningDBA
7 Replies

8. UNIX for Dummies Questions & Answers

Can A File Be Copied to an RS232 Port on Unix?

We have a text/csv file (4mb) sitting on a Unix box. The PC belongs to a retail store and they're asking me to bring the file over to Windows so they can import the file. Can a file be copied to an rs232 port? If so how? The idea is that I'll hook up a null modem cable to the Unix com port,... (2 Replies)
Discussion started by: alivebyscience
2 Replies

9. Shell Programming and Scripting

How to make a script to run everytime a new file is copied into a directory??

Hi folks I have a unix script script1 in a directory folder1 and also I have few input log files in this directory. My input log files will be copied into this directory folder1 from the portable thumb drive. Now what I want is I need to run this script1 whenever any new file is copied... (2 Replies)
Discussion started by: ks_reddy
2 Replies

10. UNIX for Dummies Questions & Answers

How to find File copied completely or else ...

In Unix, I am having one file getting copied to some directory. Which command will help me ensure, that file is not completely copied to the disk? (2 Replies)
Discussion started by: videsh77
2 Replies
Login or Register to Ask a Question