2012-06-20 9 views
11

मैं चींटी के लिए rsync से कुछ एनालॉग की जरूरत है। मुद्दा किसी भी मदद के लिए उप निर्देशिकाओं के सेट है कि पहले स्क्रिप्ट के साथ पूरा किया गया था के लिए स्रोत निर्देशिका से फ़ाइलों की प्रतिलिपि बनानेचींटी के लिए rsync का कोई भी अनुरूप?

rsync -r --ignore-existing $BASE_DIR/common/config/* $BASE_DIR/config 

धन्यवाद

उत्तर

8

आप exec उपयोग कर सकते हैं rsync from Ant कॉल करने के लिए, आप के लिए java काम इस्तेमाल कर सकते हैं है Jarsync या java-sync फोन या आप उन पुस्तकालयों में से या तो कॉल करने के लिए एक custom ant task बना सकते हैं।

7

ज़ोंबी प्रश्न लेकिन https://gist.github.com/garethr/878364 पोस्ट करने पर यदि मैंने कभी इसे स्वयं खोजा है। मामले कुछ कुछ में चिपकाया जा रहा है सार सामग्री।

<project name="{{ name }}" default="help" basedir="."> 
<property name="username" value="{{ username }}"/> 
<property name="host" value="{{ host }}"/> 
<property name="dir" value="/srv/{{ path }}/"/> 

<tstamp> 
    <format property="TODAY_UK" pattern="yyyyMMddhhmmss" locale="en,UK"/> 
</tstamp> 

<target name="help" description="show available commands" > 
<exec executable="ant" dir="." failonerror="true"> 
<arg value="-p"/> 
</exec> 
</target> 
<target name="deploy-to" description="show where we are deploying to" > 
<echo>${username}@${host}:${dir}</echo> 
</target> 

<target name="deploy" description="deploy usng rsync" > 
<exec executable="rsync" dir="." failonerror="true"> 
<arg value="-r"/> 
<arg value="."/> 
<arg value="${username}@${host}:${dir}"/> 
<arg value="--exclude-from=rsync.excludes"/> 
<arg value="-v"/> 
</exec> 
</target> 

<target name="deploy-test" description="test deploy usng rsync with the dry run flag set" > 
<exec executable="rsync" dir="." failonerror="true"> 
<arg value="-r"/> 
<arg value="."/> 
<arg value="${username}@${host}:${dir}"/> 
<arg value="--exclude-from=rsync.excludes"/> 
<arg value="--dry-run"/> 
<arg value="-v"/> 
</exec> 
</target> 

<target name="backup" description="backup site" > 
<exec executable="scp" dir="." failonerror="true"> 
<arg value="-r"/> 
<arg value="${username}@${host}:${dir}"/> 
<arg value="backups/${TODAY_UK}"/> 
</exec> 
</target> 

</project>