Hello all, I have a script that runs on different servers that does a daily dump of each database. I would like to also copy each system's file to the same NFS mounted system so that I have a local and a remote copy from each system. Obviously I don't need to copy yesterday's dump again, so I am trying to find the recent file and copy only it. I have no problem developing that find command, but I want to rename the copy in the process by pre-pending the file name with the hostname so I can differentiate between dumps from different servers. I don't want bother with having to implement a destination directory structure since new systems may come and go. So I am trying to see how this works by echoing the find output, and I can see what the problem is but I don't know how to get around it. find's {} place holder is expanding to ./<filename> and I need just <filename>
The command I am testing with is: find /var/lib/postgresql/9.1/backup -mmin -60 -a -iname '*.sql' -execdir echo "/var/data.backup/`hostname`.{}" ';' which outputs: /var/data.backup/prod1../dump_08-31-13.sql but I want it to output: /var/data.backup/prod1.dump_08-31-13.sql My final command will be a copy command similar to: find /var/lib/postgresql/9.1/backup -mmin -60 -a -iname '*.sql' -execdir cp '{}' /var/data.backup/`hostname`.'{}' ';' but I need to understand how to strip the leading ./ from the filename returned by find. Anyone have a suggestion? Thanks, Craig Sent - Gtek Web Mail -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/1377960468.350719...@webmail.gtek.biz