find

find files in linux and take backup

Tags:

Tags : find linux

Recently working on one of my projects i found how powerful linux commands are, if u have proper knowledge.

My Problems is to find a files (test.php) in a directory and its sub directory. and then take a backup of that file and then copy a new file at the same place.

# backup test.php
find */*/www/code/ -name 'test.php' -exec cp {} {}.bak \;

# copy new_test.php
find */*/www/ -name 'code' -type d -exec cp /home/new_test.php {}/ \; 2>/dev/null

Syndicate content

Connect IV

 
          Skinhat
Loading...
Best: 27 secs by harleen

Random image

nature

Poll

Recent comments