Example #1
0
        public FtpResponse ChangeDirectoryToFullPath(FullPath InPath)
        {
            FtpResponse resp = null;

            // if this FtpClient object contains a SitePath and/or HomePath, then
            // can only change the absolute dir path to a ScopePath.
            if (CompleteHomePath != null)
            {
                throw new FtpException(
                          "Cannot change dir to absolute full path." +
                          " FtpClient has a Site and/or Home RootPath." +
                          " Use the ChangeDirectoryToScopePath method instead.");
            }

            // make sure path starts with "/".
            string s1      = InPath.ToString( );
            string absPath = null;

            if (s1.SubstringLenient(0, 1) != "/")
            {
                absPath = "/" + s1;
            }
            else
            {
                absPath = s1;
            }

            // change the directory to the absolute path.
            CurrentPath.Empty();
            resp = ChangeDirectory(absPath);
            return(resp);
        }
Example #2
0
        /// <summary>
        /// change the working directory to a ScopePath off of the site
        /// RootPath.
        /// </summary>
        /// <param name="InPath"></param>
        public void ChangeDirectoryToScopePath(ScopePath InPath)
        {
            RootPath absHomePath = CompleteHomePath;

            // if this FtpClient object contains a SitePath and/or HomePath, then
            // can only change the absolute dir path to a ScopePath.
            if (absHomePath == null)
            {
                throw new FtpException(
                          "Cannot change dir to absolute scope path." +
                          " FtpClient does not have a SitePath and HomeRootPath." +
                          " Use the ChangeDirectoryToFullPath method instead.");
            }

            FullPath absPath = absHomePath + InPath;

            CurrentPath.Empty();
            ChangeDirectory(absPath.ToString( ));
        }