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?

Thanks.


//orabackup/acsdbp
//orabackup/acsdbp/archive
//orabackup/acsdbp/archive/ACSDBP_AL_ccq4ema7_1_1_139660_20150415.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_6sq444q7_1_1_139484_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_ffq4jv23_1_1_139759_20150417.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_aqq4c1tt_1_1_139610_20150414.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_85q46pae_1_1_139525_20150412.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_arq4c1tt_1_1_139611_20150414.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_86q46pae_1_1_139526_20150412.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_fgq4jv23_1_1_139760_20150417.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_97q49dj3_1_1_139559_20150413.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_6tq444q7_1_1_139485_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_87q46pae_1_1_139527_20150412.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_cdq4ema7_1_1_139661_20150415.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_fhq4jv23_1_1_139761_20150417.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_ceq4ema7_1_1_139662_20150415.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_6uq444q7_1_1_139486_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_dvq4halu_1_1_139711_20150416.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_88q46pae_1_1_139528_20150412.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_fiq4jv23_1_1_139762_20150417.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_98q49dj3_1_1_139560_20150413.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_99q49dj4_1_1_139561_20150413.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150413-03.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150411-03.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_71q44bra_1_1_139489_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_asq4c1tt_1_1_139612_20150414.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_cfq4ema7_1_1_139663_20150415.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_9cq49kjc_1_1_139564_20150413.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_72q44bra_1_1_139490_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_e0q4halu_1_1_139712_20150416.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150417-03.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_ibq4p7qq_1_1_139851_20150419.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150412-03.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_atq4c1tt_1_1_139613_20150414.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_flq4k635_1_1_139765_20150417.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_e1q4halu_1_1_139713_20150416.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_h3q4mje7_1_1_139811_20150418.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150416-03.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_icq4p7qq_1_1_139852_20150419.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_8bq470aj_1_1_139531_20150412.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_73q44bra_1_1_139491_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_74q44bra_1_1_139492_20150411.rbk
//orabackup/acsdbp/archive/ACSDBP_cnt_c-1891348399-20150415-03.rbk
//orabackup/acsdbp/archive/ACSDBP_AL_9dq49kjc_1_1_139565_20150413.rbk


[jasony@portland acsdbp]$ pwd
/mnt/nfs7/acsdbp/orabackup/acsdbp
[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*****"
        date
#       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
        date
        echo "*****End of Data Backup, Pass $x *****"
        ) >> $bklog

}

Open in new window

Jason YuAsked:
Who is Participating?
 
savoneCommented:
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 \;

Done.
0
 
Jason YuAuthor Commented:
Here is the script file in the attachment.
0
 
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?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.