Skip to main content
 

Cancella file e cartelle più vecchie di 7 giorni

Questo target ant cancella i file e le cartelle più vecchie di 7 giorni.


<target name="clear">
<tstamp>
<format property="last.week" 
 pattern="MM/dd/yyyy hh:mm a" 
 locale="en,UK" 
 offset="-7" 
 unit="day"/>
</tstamp>
<echo>Delete files and dirs before ${last.week}</echo>
<delete includeEmptyDirs="true">
<fileset dir="." includes="*/**">
<date datetime="${last.week}" when="before"/>
</fileset>
</delete>
</target>

Commando remoto con SSH

Il task SSHEXEC esegue un comando su una macchina remota usando il demone SSH.

Per esempio, esegue un comando usando autenticazione mezzo utente/password su una macchina remota:

  <sshexec host="somehost"
username="dude"
password="yo"
command="touch somefile"
trust="true"/>

Java