find files in linux and take backup
Tags:
Submitted by suresh.gju on Sat, 09/13/2008 - 17:55.
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

Recent comments
4 days 9 hours ago
5 days 2 hours ago
1 week 1 day ago
4 weeks 3 days ago
16 weeks 5 days ago
17 weeks 2 days ago
18 weeks 1 day ago
20 weeks 5 days ago
30 weeks 2 days ago
42 weeks 5 days ago