hi tried my side...
here my code is
here files coping from source to destination location we need to print successfully copied with in number...success copied=10
if failure occurred while coping files from source to destination
ex :failure=5
Well, on first sight there's quite some opportunities in your code sample.
- why use grep (btw, the regex $*.xml is somewhat dubious)? ls -t | head -1 should give the most recent .xml file.
- why define IFS=$'\n'? The file that you read has , as the field separator (OFS=,), or <TAB>, being explicitly printed.
- why not read fn dc pc ct REST from the input file and drop the four assignment lines? You'd need to define IFS corrrectly, then.
- why not define src_dir outside the while loop as it doesn't contain variables?
- why the for loop as the loop variable FILE isn't used anywhere inside the loop?
- why not use the -n (no-clobber) option to cp, as copying multiple files with identical file name (from different source dirs) to one single destination dir will overwrite the target files.
- why increment the Succ_Cnt without knowing if the cp was a success?
- why not create the dest_dir if it doesn't exist?
- why use a here document ( << redirection operator), which will fail, instead redirect stdin ( < operator)?
---------- Post updated at 12:26 ---------- Previous update was at 12:15 ----------
You may want to give this a try, although untested and needing some polishing:
hi rudic
actually my intention....i explained my necessity...here step by step
step1. reading latest xml file from source and print the values in text.file
sample text.file out put
step2;;reading text.file and copy the files from source to destination path
step3;check directory exist or not exist in target location
step4;if directory exist then copy the files from source to destination then count how many files copied according to text.file column $1 wise line by line
if 10 files copied out of 15
then print sccessfully copied =10
step5;if directory not exist (no need create directory)
just print how many files not copied successfully if 5 files failure to copy
then print failure =5
cause of failure; following destination folder or directory path not exist will print in to another text2.file
step6;finally text2.txt file will attached in mail and send notification to me
using mailx or mail command with "subject status"
if all files copied success then subject status else status error
if copied 14 files out of 15 then we need to get error status
subject: irms-cm document import into livelink mm/dd/yyyy (status = ______)
step7; after review the attached file we will create destination folders manually
Last edited by sravanreddy; 07-23-2015 at 08:01 AM..
i- Please use code tags for commands/codes/inputs you are using in your posts as per forum rules.
ii- Go through the forum rules in following link for a better understanding please. https://www.unix.com/misc.php?do=cfrules
iii- Please do not use capital letters in posts it may be taken as offense. So request you to not to repeat this.
We all are here to help and learn from each other. We should respect each other as each one has their own identity and working/learning style.
Thanks,
R. Singh
Last edited by RavinderSingh13; 07-23-2015 at 08:36 AM..
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)
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)
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
5. Post Here to Contact Site Administrators and Moderators
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)
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)
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)
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)
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)
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)