how to remove the file path from the find command

I am using this script to copy the files from one folder (/orabackup/acsdbp) to anther one (mnt/nfs7/acsdbp). The script ran very well but the destination folders includes all the path from the origination. I checked the filelist/log file, when I use "find" command to make the file name list, it includes the absolute path of the original files. How could I remove the leading  //orabackup/acsdbp?



[jasony@portland acsdbp]$ pwd
[jasony@portland acsdbp]$ ls -alth
total 36K
drwxrwxrwx  2 jasony users 8.0K Apr 21 11:36 archive
drwxrwxrwx  8 jasony users 4.0K Apr 21 11:30 .
drwxrwxrwx  3 jasony users 4.0K Apr 21 11:30 exports
drwxrwxrwx  3 jasony users 4.0K Apr 21 11:30 ..
drwxrwxrwx  2 jasony users 4.0K Apr 21 11:05 backup
drwxrwxrwx  2 jasony users 4.0K Dec 10  2011 log
drwxrwxrwx  2 jasony users 4.0K May 23  2005 cold
drwxrwxrwx  2 jasony users 4.0K May 23  2005 flash
[jasony@portland acsdbp]$

start_rsync ()

# This is the actual backup function. It finds all of the files created under /u1/backup directory and creates a file called /scripts/backuplist.$d8t. That backuplist is then used by the rsync program to copy the backup files to the $destFolder folder/mount point. The output for the whole process is sent to the $bklog file.

        echo "*****Start of Scripts Backup, Pass $x*****"
#       find /u1/backup -mtime -3 > /scripts/backuplist
  find /$sourceFolder > /home/jasony/scripts/backuplist.$d8t

#       /usr/bin/rsync -av --files-from=/home/jasony/scripts/backuplist.$d8t / $destFolder/backup$d8t
  /usr/bin/rsync -av --files-from=/home/jasony/scripts/backuplist.$d8t / $destFolder
        echo "*****End of Data Backup, Pass $x *****"
        ) >> $bklog


Open in new window

Jason YuAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason YuAuthor Commented:
Here is the script file in the attachment.
Chris HInfrastructure ManagerCommented:
find /u1/backup -mtime -3 -type f -printf "%f\n" > /scripts/backuplist
find /$sourceFolder -type f -printf "%f\n" > /home/jasony/scripts/backuplist.$d8t

Can  you change lines 9 and 10 as above and see if this works?
The problem is your execution. You are making something that is simple, into something that is unnecessarily complicated.

Copy all the files from /u1/backup to $destFolder/backup$d8t use this command:

find /u1/backup -mtime -3 -exec cp -v {} $destFolder/backup$d8t >> logfile.txt \;


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.