LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-13-2008, 12:06 AM   #1
nagendrar
Member
 
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 154

Rep: Reputation: 15
Is there any command to check the each and every file copied recursively or not?


good moring!
pls give the suggetions for me.

I am copying the files recursively from one dir to another dir.

Here I am trying as below:
But here we get the each file recursively using find command.
If this file copied in installation path ,i am getting two files as

ex :
fname1=aaa/bbb/a.txt
installPath=/home/all/
then I am getting /home/all/aaa/bbb/a.txt , /home/all/a.txt

for fname in $folders
do
if [ -d "./$fname" ]
then
files=`find "$fname"`
for fname1 in $files
do
cp -r --preserve=mode $fname1 "${installPath}"/.
if [ $? -eq 0 ]
then
echo "Copied the file: "${installPath}""${fname1}"" >> "${installPath}"/SRMsetuplog.log
else
echo "Could not copy the file:"${installPath}""${fname1}"" >> "${installPath}"/SRMsetuplog.log
fi
done
fi
done


Is there any command to check the each and every file copied or not?

Pls give the suggetions for me

Thanq,
Nagendra
 
Old 05-13-2008, 12:31 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Use rsync rather than copy ... "man rsync" for complete information.
 
Old 05-13-2008, 06:39 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This line

if [ -d "./$fname" ]

does not make sense.

./$fname means run this prog in the current dir

-d means is this a dir

Try

if [[ -d $fname ]]

Also,
installPath=/home/all/

ends with a slash, so

"${installPath}"/.

should be

"${installPath}"

and in fact drop the double quotes unless you have spaces in the filenames/dirnames (don't do that though...)




also, please provide the whole prog in code tags so the indentation shows up as well.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I think I copied a file over my entire Windows partition transparent9 Linux - Newbie 42 11-28-2016 03:33 PM
Copied xorg.conf file, now X won't load Shaw-n Linux - Newbie 6 04-19-2006 12:54 AM
shell command to grab filetypes recursively Nice-n-Slow Programming 1 05-13-2005 07:05 AM
Recursively browse graphics on CD from command line ewto Linux - Software 1 03-11-2005 10:04 PM
Tar command copied multiple times? cbriscoejr Linux - General 1 11-12-2004 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration