DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Joshua has posted 4 posts at DZone. View Full User Profile

Adding Local Cd And Pwd To CFSFTP

07.08.2009
| 2655 views |
  • submit to reddit
        // I really like working with cfsftp for ColdFusion MX 7 projects, 
// but I discovered that while there was a 'cd' method to change 
// directory on the host, there wasn't one to change the current 
// working directory locally. So here are a few methods I created
// in sftp.cfc to help out with this. 

// cfsftp located at http://www.socialpoints.com/mangoblog/page.cfm/sftp-cfc (v1.3.2)

// I'm sending an email to the maintainer for this cfc to see if he
// will patch it in, or if I'm missing some convention that already 
// gives me this ability.

    <cffunction name="getWorkingDir" displayname="getWorkingDir" access="public" output="false" returntype="string" hint="I return the current local working directory.">
        <cfreturn variables.working_dir>
    </cffunction>

    <cffunction name="setWorkingDir" displayname="getWorkingDir" access="public" output="false" returntype="void" hint="I alter the current local working directory.">
        <cfargument name="new_dir" type="string" required="true">

        <cfset variables.working_dir = expandPath(arguments.new_dir)>
    </cffunction>