Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Scenario:

2 Servers (*.12 and *.13)

CakePHP "application" on both of them.

*.12 is "Production" Server
*.13 is "Development" Server

Now i want to copy all files modified the last 2 days from test server to production server WITHOUT the directory ./tmp

i can find them on production server with:

find ./ -type d -name tmp -prune -o  -mtime -2 -exec ls {} \;

On both servers i have only ssh access.

share|improve this question
add comment

1 Answer

Although this doesn't grab things only modified in the last two days, you probably want rsync to keep your files in sync:

rsync -av --delete --exclude=./tmp/* ./ user@production:/path/

For the find command, you can uses scp:

find ./ -type d -name tmp -prune -o  -mtime -2 -exec bash -c 'scp "$1" user@production:/path/"$1"' -- {} \;
share|improve this answer
    
Thanks.. will need to setup rsync then on the development first i think... –  Michael Grenzer Mar 30 '13 at 18:19
    
@MichaelGrenzer It's installed by default on most Linux systems. The transfer is done over SSH. –  jordanm Mar 30 '13 at 18:20
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.