public static void actionMove ( PageContext pageContext , lucee . runtime . security . SecurityManager securityManager , Resource source , String strDestination , int nameconflict , String serverPassword , Object acl , int mode , String attributes ) throws PageException { if ( nameconflict == NAMECONFLICT_UNDEFINED ) nameconflict = NAMECONFLICT_OVERWRITE ; if ( source == null ) throw new ApplicationException ( "attribute source is not defined for tag file" ) ; if ( StringUtil . isEmpty ( strDestination ) ) throw new ApplicationException ( "attribute destination is not defined for tag file" ) ; Resource destination = toDestination ( pageContext , strDestination , source ) ; securityManager . checkFileLocation ( pageContext . getConfig ( ) , source , serverPassword ) ; securityManager . checkFileLocation ( pageContext . getConfig ( ) , destination , serverPassword ) ; if ( source . equals ( destination ) ) return ; // source if ( ! source . exists ( ) ) throw new ApplicationException ( "source file [" + source . toString ( ) + "] doesn't exist" ) ; else if ( ! source . isFile ( ) ) throw new ApplicationException ( "source file [" + source . toString ( ) + "] is not a file" ) ; else if ( ! source . isReadable ( ) || ! source . isWriteable ( ) ) throw new ApplicationException ( "no access to source file [" + source . toString ( ) + "]" ) ; // destination if ( destination . isDirectory ( ) ) destination = destination . getRealResource ( source . getName ( ) ) ; if ( destination . exists ( ) ) { // SKIP if ( nameconflict == NAMECONFLICT_SKIP ) return ; // OVERWRITE else if ( nameconflict == NAMECONFLICT_OVERWRITE ) destination . delete ( ) ; // MAKEUNIQUE else if ( nameconflict == NAMECONFLICT_MAKEUNIQUE ) destination = makeUnique ( destination ) ; // ERROR else throw new ApplicationException ( "destiniation file [" + destination . toString ( ) + "] already exist" ) ; } setACL ( pageContext , destination , acl ) ; try { source . moveTo ( destination ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; throw new ApplicationException ( t . getMessage ( ) ) ; } setMode ( destination , mode ) ; setAttributes ( destination , attributes ) ; }
move source file to destination path or file