0

I have a file "backup". I want to find that particular file and take a backup with cp command and the backup file will be "backup_b".

The code which i am executing is below

find /u01/app/gafmbs/backup_b -exec cp backup_b backup

But this is not working. How will i do that? Can anybody help me out?

  • https://stackoverflow.com/questions/5241625/find-and-copy-files or, https://stackoverflow.com/questions/1562102/bash-find-and-copy should help you. – Tonmoy Feb 07 '18 at 09:35

1 Answers1

1

You are not invoking find correctly.

A fix:

find /u01/app/gafmbs -name backup_b -exec cp {} backup \;
     ^               ^                       ^         ^
     |               |                       |         |
     where to look   |                       |         exec command terminator
                     what to look for        |
                                             paths to found files
Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271