Sponsored Content
Top Forums Shell Programming and Scripting Count the number of files copied from source to destination location Post 302950910 by sravanreddy on Thursday 30th of July 2015 03:59:31 AM
Old 07-30-2015
Hello SriniShoo,

Can you explain code we con't count succ_count and error count using below code
can you correct my code
Code:
src_dir="/home/oracle/arun/IRMS-CM"
dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc"
for FILE in $src_dir/{$fn,*/$fn}
do
if [ -d $dest_dir ]; then
if [ -d $dest_dir/$pc ]; then
  if [ -d $dest_dir/$pc/$ct ]; then   
  if [ -f $FILE ];then
     cp $FILE $dest_dir/$pc/$ct && ((Succ_Cnt++)) || ((Err_Cnt++))
fi    
else
echo "$dest_dir/$pc/$ct not exists"
fi
 elif [ -d $dest_dir/$ct ];then
 cp $FILE $dest_dir/$ct && ((Succ_Cnt1++))
fi
else
echo "$dest_dir/$pc/$ct not exists"
fi
done
done< XmlDataNew.txt 
Succ=$[$Succ_Cnt1+$Succ_Cnt]
echo "Succ=$Succ"
echo $Err_Cnt

any body correct and clarify my doubt

how to count successfully fully copied files from source to target location
else error_count if directory not exist or file not exist at source location.
i want below manner
Code:
successcount=10 (out of 15)
error count=5(out of 15)
 or
successcount=15(out of 15)
error_count=0

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count total unique destination for source

Hi, need help how to count unique destination for the source ip. The file is contains 4 number of fields. Example of the file is here src ip dest ip #of flows total bytes 192.168.6.0 88.0.33.2 12 128 192.168.6.0 88.0.33.2 1 168 192.168.6.0 ... (5 Replies)
Discussion started by: new_buddy
5 Replies

2. Shell Programming and Scripting

Moving extremely large number of files to destination

Hello Techies, m here with a small issue. Have read out all the relavent threads on unix.com but it was not so good sol. for me. It's a simple & known issue. I want to move lots of files to dest folder. Actually I want to pick up 1 year older files, but that is even taking lots of... (16 Replies)
Discussion started by: kedar.mehta
16 Replies

3. Shell Programming and Scripting

Move all files from source to destination directory based on the filename

Move all files starting with a specific name to different directory. This shell script program should have three parameters File Name Source Directory Destination Directory User should be able to enter ‘AB_CD*' in file name parameter. In this case all the files starting with AB_CD will... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

4. Linux

rpmbuild, how to specify a different source and destination path for files

I'd like to specify a different build and deployment path for files, by default the same path is used for both build and install, I wasn't able to find a way to make these different. With Solaris pkgadd, one can specify different paths in prototype, so I would assume something like that is possible... (0 Replies)
Discussion started by: tiburblium
0 Replies

5. Shell Programming and Scripting

How to count number of files in directory and write to new file with number of files and their name?

Hi! I just want to count number of files in a directory, and write to new text file, with number of files and their name output should look like this,, assume that below one is a new file created by script Number of files in directory = 25 1. a.txt 2. abc.txt 3. asd.dat... (20 Replies)
Discussion started by: Akshay Hegde
20 Replies

6. Post Here to Contact Site Administrators and Moderators

How to count successfully copy files source to target location with check directory in Linux?

Hi guys...please any one help me .... how to copy files from source to target location if 5 files copied successfully out of 10 files then implement success=10 and if remaining 5 files not copied successfully then count error=5 how to implement this condition with in loop i need code linux... (0 Replies)
Discussion started by: sravanreddy
0 Replies

7. UNIX for Dummies Questions & Answers

How to count number files successfully copied from source to target location?

Hi Guys, how to count number of files successfully copied while coping files from source to destination path ex:10 files from source to target location copying if 8 files copied successfully then echo successfully copied=8 failure=2 files if two files get error to coping files... (2 Replies)
Discussion started by: sravanreddy
2 Replies

8. Shell Programming and Scripting

Error files count while coping files from source to destination locaton as well count success full

hi All, Any one answer my requirement. I have source location src_dir="/home/oracle/arun/IRMS-CM" My Target location dest_dir="/home/oracle/arun/LiveLink/IRMS-CM/$dc/$pc/$ct" my source text files check with below example.text file content $fn "\t" $dc "\t" $pc "\t" ... (3 Replies)
Discussion started by: sravanreddy
3 Replies

9. UNIX for Dummies Questions & Answers

How to move gz files from one source directory to destination directory?

Hi All, Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder. using the find command . Could you please assist me how to put the automation using the shell script . ... (11 Replies)
Discussion started by: venkat918
11 Replies

10. UNIX for Beginners Questions & Answers

Open ports from source to destination

Is there a way to find out all the ports open between source IP & destination IP in any way ? (12 Replies)
Discussion started by: UnknownGuy
12 Replies
E2CP(1) 						      General Commands Manual							   E2CP(1)

NAME
e2cp - copies files from/to an e2fs filesystem SYNOPSIS
e2cp [options] files... dest DESCRIPTION
The e2cp command copies files to/from an e2fs filesystem from/to the machine's filesystem. OPTIONS
A single `-' (dash) can be used instead of a file name to indicate standard input/output. -0 Input lines terminated by a null character. -a Absolute directory names - create directories instead of just copying into the destination. Only valid for copying into an ext2fs filesystem. -d dest_dir Destination of files to be copied. May be in the ext2fs filesystem or the host filesystem. -G gid Set the default group to gid. -O uid Set the default file owner to uid. -p Preserve host file attributes (permissions, times, etc.) when copying files. -P mode Set the file permissions (ie 755, 666). -s src_dir The source of the files to be copied. -v Be verbose. SEE ALSO
e2tools(7), e2ln(1), e2ls(1), e2mkdir(1), e2mv(1), e2rm(1), e2tail(1). AUTHOR
The e2tools were written by Keith Sheffield <sheff@pobox.com>. This manual page was written by Lucas Wall <lwall@debian.org>, for the Debian project (but may be used by others). March 2, 2005 E2CP(1)
All times are GMT -4. The time now is 02:56 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy