コード例 #1
0
        /// <summary>
        /// Rename a local file.
        /// </summary>
        /// <param name="oldFileName"></param>
        private void RenameLocalFile(string oldFileName)
        {
            string newFileName;

            frmRenameFile frm = new frmRenameFile();
            if ((newFileName = frm.ShowModal(oldFileName)) != oldFileName)
            {
                try
                {
                    File.Move(sLocalPath + "\\" + oldFileName, sLocalPath + "\\" + newFileName);
                }
                catch (Exception ex)
                {
                    Warning("", ex.Message);
                }

            }
        }
コード例 #2
0
        /// <summary>
        /// Rename a file on the remote FTP server.
        /// </summary>
        /// <param name="oldFileName"></param>
        private void RenameFile(string oldFileName)
        {
            string newFileName;
            bool overwrite = false;

            frmRenameFile frm = new frmRenameFile();
            if ((newFileName = frm.ShowModal(oldFileName)) != oldFileName)
            {
                try
                {
                    if (ftpClient != null)
                    {
                        ftpClient.RenameFile(oldFileName, newFileName, overwrite);
                    }
                }
                catch (FtpClient.FtpException ex)
                {
                    Warning("", ex.Message);
                }

            }
        }