MoveTo() private method

private MoveTo ( String destDirName ) : void
destDirName String
return void
Example #1
0
        }//method

        public void DownloadFun(object o)
        {
            while (_avs.Count > 0)
            {
                Av a;
                try
                {
                    a = _avs.Dequeue();
                }
                catch (InvalidOperationException e) {
                    return;
                }

                string url  = basePath + "/" + a.Id;
                string html = "";
                try
                {
                    html = Download.GetHtml(url);
                }
                catch (Exception e)
                {
                    _syncContext.Post(OutError, a.Id + " :查询网站异常");
                    continue;
                }
                if (html.IndexOf("404 Page Not Found") != -1)
                {
                    _syncContext.Post(OutError, a.Id + " :找不到该番号");
                }
                else
                {
                    int    fg   = a.Path.LastIndexOf("\\") + 1;
                    string name = a.Path.Substring(fg, a.Path.Length - fg).Trim();
                    System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(a.Path);

                    if (!Directory.Exists(a.ToPath + "\\" + a.Id))
                    {
                        Directory.CreateDirectory(a.ToPath + "\\" + a.Id);
                    }
                    if (a.Oname.IndexOf("-cd") != -1)
                    {
                        folder.MoveTo(a.ToPath + "\\" + a.Id + "\\" + a.Oname);
                    }
                    else
                    {
                        if (File.Exists(a.ToPath + "\\" + a.Id + "\\" + name))
                        {
                            _syncContext.Post(OutLog, a.Path + "出现重复!!!!!!!!!!" + a.Id + "");
                        }
                        else
                        {
                            folder.MoveTo(a.ToPath + "\\" + a.Id + "\\" + name);
                            File.Create(a.ToPath + "\\" + a.Id + "\\" + folder.Name + ".old.name").Close();
                        }
                    }
                    _syncContext.Post(OutLog, a.Id + "");
                }
            } //while
            _syncContext.Post(OutLog, "线程退出");
        }     //method
Example #2
0
        public void dirRename(DirectoryInfo incDir)
        {
            string newDir = incDir.Name,
                oldDir = incDir.FullName;

            parseAll(ref newDir);

            newDir = Path.Combine(incDir.Parent.FullName, newDir);

            if (newDir == oldDir)
                return;

            if (!Directory.Exists(newDir))
                try
                {
                    incDir.MoveTo(newDir);

                    if (flgVerbose)
                        Console.WriteLine(String.Format("{0} -->> {1}", oldDir, newDir));
                }
                catch { Console.WriteLine(String.Format("Error: unable to rename, check permissions: {0}", incDir.FullName)); }
            else
                Console.WriteLine(String.Format("Error: directory already exists: {0}",
                    Path.Combine(incDir.Parent.FullName, newDir)));
        }
        public static bool RenameUserProfile(string userProfileName, DirectoryInfo userDataDir, string newUserProfileName)
        {
            var isRenamed = false;

            if (userProfileName != null && userDataDir != null && newUserProfileName != null)
            {
                var src = new DirectoryInfo(userDataDir.FullName + "\\" + userProfileName);
                var dst = new DirectoryInfo(userDataDir.FullName + "\\" + newUserProfileName);

                try
                {
                    if (src.Parent != null)
                    {
                        if (src.Exists && !dst.Exists)
                        {
                            src.MoveTo(Path.Combine(src.Parent.FullName, newUserProfileName));
                        }

                        isRenamed = true;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            return isRenamed;
        }
        public void MoveFolderInsideTheWatchedFolder() {
            string oldName = Path.GetRandomFileName();
            string newName = Path.GetRandomFileName();
            using (FileSystemWatcher fsWatcher = new FileSystemWatcher(this.path)) {
                fsWatcher.IncludeSubdirectories = true;
                fsWatcher.Filter = "*";
                fsWatcher.InternalBufferSize = 4 * 1024 * 16;
                fsWatcher.NotifyFilter = NotifyFilters.Size | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastWrite | NotifyFilters.Security;
                fsWatcher.Created += (object sender, FileSystemEventArgs e) => this.list.Add(e);
                fsWatcher.Changed += (object sender, FileSystemEventArgs e) => this.list.Add(e);
                fsWatcher.Deleted += (object sender, FileSystemEventArgs e) => this.list.Add(e);
                fsWatcher.Renamed += (object sender, RenamedEventArgs e) => this.list.Add(e);
                DirectoryInfo dirA = new DirectoryInfo(Path.Combine(this.path, Path.GetRandomFileName()));
                dirA.Create();
                DirectoryInfo dirB = new DirectoryInfo(Path.Combine(this.path, Path.GetRandomFileName()));
                dirB.Create();
                DirectoryInfo movingDir = new DirectoryInfo(Path.Combine(dirA.FullName, oldName));
                movingDir.Create();
                fsWatcher.EnableRaisingEvents = true;
                movingDir.MoveTo(Path.Combine(dirB.FullName, newName));
                while (this.list.Count < 2) {
                    Thread.Sleep(100);
                }

                Assert.That(this.list.Count, Is.GreaterThanOrEqualTo(2));
                Assert.That(this.list[0].ChangeType, Is.EqualTo(WatcherChangeTypes.Deleted));
                Assert.That(this.list[0].FullPath, Is.EqualTo(Path.Combine(dirA.FullName, oldName)));
                Assert.That(this.list[1].ChangeType, Is.EqualTo(WatcherChangeTypes.Created));
                Assert.That(this.list[1].FullPath, Is.EqualTo(Path.Combine(dirB.FullName, newName)));
            }
        }
        public void CopyDirectories()
        {
            string destinationPath = Settings.Default.DestinationPath;
            string[] directories = Directory.GetDirectories(_desktopDirectory);

            foreach (string directory in directories)
            {
                string dirName = Path.GetFileName(directory);

                if (dirName != null)
                {
                    if (!IsBlacklistedDir(dirName))
                    {
                        string destinationDirectory = Path.Combine(destinationPath, dirName);

                        if (Directory.Exists(destinationDirectory))
                        {
                            int doubleCounter = Settings.Default.DoubleFileExtension;

                            string name = dirName;
                            name = name + "{" + doubleCounter + "}";

                            destinationDirectory = Path.Combine(destinationPath, name);

                            doubleCounter++;
                            Settings.Default.DoubleFileExtension = doubleCounter;
                        }

                        var info = new DirectoryInfo(directory);
                        info.MoveTo(destinationDirectory);
                    }
                }
            }
        }
Example #6
0
 private void btn_MoveDir_Click(object sender, EventArgs e)
 {
     string strPath1 = this.txt_Path1.Text;
     string strPath2 = this.txt_Path2.Text;
     DirectoryInfo dirInfo = new DirectoryInfo(strPath1);
     dirInfo.MoveTo(strPath2);
 }
        void OPMShellTreeView_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Label))
            {
                string newName = e.Label;
                DirectoryInfo di = new DirectoryInfo(e.Node.FullPath);
                if (di != null && di.Exists && di.Parent != null && di.Parent.Exists)
                {
                    string newPath = Path.Combine(di.Parent.FullName, newName);

                    try
                    {
                        di.MoveTo(newPath);
                        e.Node.Name = di.Name;
                        e.Node.Tag = di;
                        e.CancelEdit = false;

                        SelectedNode = null;
                        SelectedNode = e.Node;

                        return;
                    }
                    catch { }
                }
            }

            e.CancelEdit = true;
        }
Example #8
0
    //安卓工程打完后通过Gradle自动打APK包
    private void AutoBuildGradleApk(string apkFullPath, string apkName)
    {
        string srcFolderPath = apkFullPath + "/" + Application.productName;
        string apkPath       = apkFullPath + "/" + apkName;

        //因为出的工程是带中文路径的 Gradle 不能出现中文 所以此处手动修改
                if(System.IO.Directory.Exists(srcFolderPath))
        {
                        System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(srcFolderPath);
                        folder.MoveTo(apkPath);
                    
        }
        string strFilePath = Path.Combine(apkPath + @"/src/main/", "AndroidManifest.xml");

        if (File.Exists(strFilePath))
        {
            string strContent    = File.ReadAllText(strFilePath);
            string newstrContent = strContent.Replace("android:hardwareAccelerated=\"false\"", "android:hardwareAccelerated=\"true\"");
            File.WriteAllText(strFilePath, newstrContent);
        }
        string path = FormatPath(Application.dataPath + @"/Editor/");

        if (Application.platform == RuntimePlatform.OSXEditor)
        {
            RunShell(apkPath);
        }
        else if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            RunBat("gradle_build_apk.bat", apkPath, path);
        }
    }
Example #9
0
 public override void DeleteFolder(DirectoryInfo info, bool recursive)
 {
     if (!recursive && info.GetFileSystemInfos().Length != 0)
     throw new InvalidOperationException(S._("The folder {0} cannot be deleted as it is " +
      "not empty."));
        foreach (DirectoryInfo dir in info.GetDirectories())
     DeleteFolder(dir);
        foreach (FileInfo file in info.GetFiles())
     DeleteFile(file);
        for (int i = 0; i < FileNameErasePasses; ++i)
        {
     string newPath = GenerateRandomFileName(info.Parent, info.Name.Length);
     try
     {
      info.MoveTo(newPath);
     }
     catch (IOException)
     {
      Thread.Sleep(100);
      --i;
     }
        }
        info.CreationTime = info.LastWriteTime = info.LastAccessTime = MinTimestamp;
        info.Delete(true);
 }
Example #10
0
 public static DirectoryInfoModifyingBegun BeginModifying(this DirectoryInfo orgInfo)
 {
     var id = Guid.NewGuid().ToString("N");
     var bakInfo = new DirectoryInfo(orgInfo.FullName);
     var bakPath = orgInfo.FullName + "." + id + ".bak";
     if (bakInfo.Exists)
         bakInfo.MoveTo(bakPath);
     return new DirectoryInfoModifyingBegun(orgInfo, bakPath);
 }
    //[Repeat(3)]
    public void moveDatabaseLocations()
    {
      SessionBase.BaseDatabasePath = "d:/Databases"; // use same as VelocityDbServer.exe.config 
      DirectoryInfo info = new DirectoryInfo(Path.Combine(SessionBase.BaseDatabasePath,  systemDir));
     if (info.Exists)
        info.Delete(true);
      DirectoryInfo newInfo = new DirectoryInfo(Path.Combine(SessionBase.BaseDatabasePath,  systemDir + "MovedTo"));
      string newPath = newInfo.FullName;
      if (newInfo.Exists)
        newInfo.Delete(true);
      createDatabaseLocations(new SessionNoServer(systemDir));
      info.MoveTo(newPath);
      moveDatabaseLocations(new SessionNoServer(newPath, 2000, false, false), systemHost, newPath);
      verifyDatabaseLocations(new SessionNoServer(newPath));
      info.Delete(true);

      info = new DirectoryInfo(Path.Combine(SessionBase.BaseDatabasePath, systemDir));
      if (info.Exists)
        info.Delete(true);
      createDatabaseLocations(new ServerClientSession(systemDir));
      newPath = Path.Combine(SessionBase.BaseDatabasePath, systemDir + "MovedTo");
      info.MoveTo(newPath);
      moveDatabaseLocations(new ServerClientSession(newPath, systemHost, 2000, false, false), systemHost, newPath);
      verifyDatabaseLocations(new ServerClientSession(newPath, systemHost));
      info.Delete(true);

      info = new DirectoryInfo(Path.Combine(SessionBase.BaseDatabasePath, systemDir));
      if (info.Exists)
        info.Delete(true);
      string d = SessionBase.BaseDatabasePath;
      try
      {
        SessionBase.BaseDatabasePath = "\\\\" + systemHost2 + "\\Shared";
        newPath = Path.Combine(SessionBase.BaseDatabasePath, systemDir);
        info = new DirectoryInfo(newPath);
        createDatabaseLocations(new ServerClientSession(newPath, systemHost2));
        SessionBase.BaseDatabasePath = d;
        newPath = Path.Combine(SessionBase.BaseDatabasePath, systemDir + "MovedTo");
        string[] files = Directory.GetFiles(info.FullName);
        Directory.CreateDirectory(newPath);
        foreach (string file in files)
        {
          string name = Path.GetFileName(file);
          string dest = Path.Combine(newPath, name);
          File.Copy(file, dest);
        }
        info.Delete(true);
        info = new DirectoryInfo(newPath);
        moveDatabaseLocations(new ServerClientSession(newPath, systemHost, 2000, false, false), systemHost, newPath);
        verifyDatabaseLocations(new ServerClientSession(newPath));
        info.Delete(true);
      }
      finally
      {
        SessionBase.BaseDatabasePath = d;
      }
    }
Example #12
0
 /// <summary>
 /// Moves a folder to another destination.
 /// </summary>
 /// <param name="folderToMove">The folder to be moved.</param>
 /// <param name="destinationFolder">The destination folder to where the folder should be moved.</param>
 /// <param name="createDestinationFolder">Defines if the destination folder must be created if it doesn't exist.</param>
 /// <returns>A boolean indicating that the move was successful.</returns>
 public static bool MoveFolder(string folderToMove, string destinationFolder, bool createDestinationFolder)
 {
     if (Directory.Exists(folderToMove))
     {
         var dInfo = new DirectoryInfo(folderToMove);
         dInfo.MoveTo(PathHelper.ValidateEndOfPath(destinationFolder));
     }
     return true;
 }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                status = arr[0];
            else if (radioButton2.Checked)
                status = arr[1];
            else if (radioButton3.Checked)
                status = arr[2];
            else if (radioButton4.Checked)
                status = arr[3];
            else if (radioButton5.Checked)
                status = arr[4];
            else if (radioButton6.Checked)
                status = arr[5];

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {

                DirectoryInfo d = new DirectoryInfo(folderBrowserDialog1.SelectedPath);
                string selectedpath = d.Parent.FullName + d.Name;
                if (folderBrowserDialog1.SelectedPath.LastIndexOf(".{") == -1)
                {
                    if (checkBox1.Checked)
                        setpassword(folderBrowserDialog1.SelectedPath);
                    if (!d.Root.Equals(d.Parent.FullName))
                    d.MoveTo(d.Parent.FullName + "\\" + d.Name + status);
                    else d.MoveTo(d.Parent.FullName + d.Name + status);
                    textBox1.Text = folderBrowserDialog1.SelectedPath;
                    pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\lock.jpg");
                }
                else
                {
                    status = getstatus(status);
                    bool s=checkpassword();
                    if (s)
                    {
                        File.Delete(folderBrowserDialog1.SelectedPath + "\\p.xml");
                        d.MoveTo(folderBrowserDialog1.SelectedPath.Substring(0, folderBrowserDialog1.SelectedPath.LastIndexOf(".")));
                        textBox1.Text = folderBrowserDialog1.SelectedPath.Substring(0, folderBrowserDialog1.SelectedPath.LastIndexOf("."));
                        pictureBox1.Image = Image.FromFile(Application.StartupPath + "\\unlock.jpg");
                    }
                }
            }
        }
 public static void Main()
 {
     // ...
     DirectoryInfo directory = new DirectoryInfo(".\\Source");
     directory.MoveTo(".\\Root");
     DirectoryInfoExtension.CopyTo(
         directory, ".\\Target",
         SearchOption.AllDirectories, "*");
     // ...
 }
Example #15
0
		/// <summary>
		/// ITestStep.Execute() implementation
		/// </summary>
		/// <param name='testConfig'>The Xml fragment containing the configuration for this test step</param>
		/// <param name='context'>The context for the test, this holds state that is passed beteen tests</param>
		public void Execute(XmlNode testConfig, Context context)
		{
			string srcDirectory = context.ReadConfigAsString( testConfig, "SourceDirectory");
			string dstDirectory = context.ReadConfigAsString( testConfig, "DestinationDirectory");

			context.LogInfo("About to renme the directory \"{0}\" to \"{1}\"", srcDirectory, dstDirectory);

			var di = new DirectoryInfo(srcDirectory);
			di.MoveTo(dstDirectory);
		}
Example #16
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         DirectoryInfo DInfo = new DirectoryInfo(textBox1.Text);//创建DirectoryInfo对象
         //设置移动路径
         string strPath = textBox2.Text + textBox1.Text.Substring(textBox1.Text.LastIndexOf("\\") + 1, textBox1.Text.Length - textBox1.Text.LastIndexOf("\\") - 1);
         DInfo.MoveTo(strPath);//移动文件夹
     }
     catch { MessageBox.Show("移动的文件必须在同一盘符下!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); }
 }
Example #17
0
        public void MoveToDestination(string target)
        {
            if (string.IsNullOrEmpty(target)) return;
            if (!Directory.Exists(target)) return;
            if (target == FullPath) return;

            DirectoryInfo folder = new DirectoryInfo(FullPath);
            var destination = Path.Combine(target, folder.Name);
            Console.WriteLine(string.Format("move {0} to {1}", FullPath, destination));
            folder.MoveTo(destination);
        }
Example #18
0
 static public int MoveTo(IntPtr l)
 {
     try {
         System.IO.DirectoryInfo self = (System.IO.DirectoryInfo)checkSelf(l);
         System.String           a1;
         checkType(l, 2, out a1);
         self.MoveTo(a1);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 public static void MoveDirectory(string sourceDirectoryPath, string destinationDirectoryPath)
 {
     if (sourceDirectoryPath != null && destinationDirectoryPath != null)
     {
         try
         {
             var directoryInfo = new DirectoryInfo(sourceDirectoryPath);
             directoryInfo.MoveTo(destinationDirectoryPath);
         }
         catch (Exception ex)
         {
             Directory.Move(sourceDirectoryPath, destinationDirectoryPath);
         }
     }
 }
Example #20
0
        /// <summary>
        /// Archives EVERYTHING
        /// </summary>
        public void ArchiveFull()
        {
            //wth, no current directory? Noithing to move then
            if (VerifyDirectory(CurrentDirectoryName, false) && VerifyDirectory(ArchiveDirectoryName))
            {
                var currentRoot = new DirectoryInfo(BaseDirectory + CurrentDirectoryName);

                //move is literal move, no need to delete afterwards
                currentRoot.MoveTo(DatedBackupDirectory);
            }

            //something very wrong is happening, it'll get logged
            if (!VerifyDirectory(CurrentDirectoryName))
                throw new Exception("Can not locate or verify current live data directory.");
        }
Example #21
0
        private void button_run_Click(object sender, EventArgs e)
        {
            string filePath = this.textBox_filePath.Text;
            if (filePath != "" && filePath != null)
            {
                string[] filenames = Directory.GetDirectories(filePath);
                if (filenames.Length > 0)
                {
                    foreach (string pathName in filenames)
                    {
                        DirectoryInfo info = new DirectoryInfo(pathName);
                        if (info != null)
                        {
                            string name = info.Name;
                            string newName = Regex.Replace(name, @"([\S\s]+?)[ ]{1,}([\d]{4}-[\d]+-[\d]+)[ ]{1,}([\s\S]+)", @"$2 $1 $3");
                            //MessageBox.Show(filePath+"\\"+newName);
                            if (newName != "" && newName != null && !name.Equals(newName))
                            {
                                try
                                {
                                    info.MoveTo(filePath + @"\" + newName);
                                }
                                catch (IOException ioe)
                                {
                                    MessageBox.Show(ioe.Message);
                                }

                            }

                        }
                        //MessageBox.Show(name);
                        //Directory.Move()
                    }
                    MessageBox.Show("重命名完成!");
                }
                else
                {
                    MessageBox.Show("该目录中没有文件夹!");
                }

            }
            else
            {
                MessageBox.Show("文件目录不能为空!");
            }
        }
Example #22
0
        static void Main(string[] args)
        {
            Directory.Move(@"C:\source", @"c:\destination");
            DirectoryInfo directoryInfo = new DirectoryInfo(@"C:\Source");
            directoryInfo.MoveTo(@"C:\destination");

            foreach (string file in Directory.GetFiles(@"C:\Windows"))
            {
                Console.WriteLine(file);
            }
            DirectoryInfo directoryInfo3 = new DirectoryInfo(@"C:\Windows");
            foreach (FileInfo fileInfo in directoryInfo3.GetFiles())
            {
                Console.WriteLine(fileInfo.FullName);
            }

            string path = @"c:\temp\test.txt";
            if (File.Exists(path))
            {
                File.Delete(path);
            }
            FileInfo fileInfo1 = new FileInfo(path);
            if (fileInfo1.Exists)
            {
                fileInfo1.Delete();
            }

            string path1 = @"c:\temp\test.txt";
            string destPath = @"c:\temp\destTest.txt";
            File.CreateText(path).Close();
            File.Move(path1, destPath);
            FileInfo fileInfo2 = new FileInfo(path1);
            fileInfo2.MoveTo(destPath);

            string path3 = @"c:\temp\test.txt";
            string destPath2 = @"c:\temp\destTest.txt";
            File.CreateText(path3).Close();
            File.Copy(path3, destPath2);
            FileInfo fileInfo3 = new FileInfo(path3);
            fileInfo3.CopyTo(destPath2);

            Console.WriteLine(Path.GetDirectoryName(path)); // Displays C:\temp\subdir
            Console.WriteLine(Path.GetExtension(path)); // Displays .txt
            Console.WriteLine(Path.GetFileName(path)); // Displays file.txt
            Console.WriteLine(Path.GetPathRoot(path)); // Displays C:\
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if ((textBox1.Text != "") && (textBox2.Text != "") && (textBox3.Text != ""))
            {
                try
                {
                    conn.Open();
                    comm.Connection = conn;
                    string idGroup = group.SelectedValue.ToString();
                    if (type == "update")
                    {
                        string dir = getPrepodPuth(group.SelectedValue);
                        string oldFolder = Application.StartupPath + dir + folderName;
                        string newFolder = Application.StartupPath + dir + "Работы студентов\\" + textBox1.Text + " " + textBox2.Text + " " + textBox3.Text;
                        DirectoryInfo drInfo = new DirectoryInfo(oldFolder.Remove(oldFolder.Length - 1));
                        drInfo.MoveTo(newFolder);
                        comm.CommandText = "update Студент set Фамилия = '" + textBox1.Text + "', Имя = '" + textBox2.Text + "', Отчество = '" + textBox3.Text + "', [№ группы] = '" + group.SelectedValue.ToString() + "', [Ссылка на работы] = 'Работы студентов\\" + textBox1.Text + " " + textBox2.Text + " " + textBox3.Text + "\\' where [№ студента] = '" + id + "'";
                        //--------------------------------------добавка с файлом history.txt
                        //if (!File.Exists())
                    }
                    else
                    {
                        string dir = getPrepodPuth(group.SelectedValue);
                        string path = "Работы студентов\\" + textBox1.Text + " " + textBox2.Text + " " + textBox3.Text + "\\";
                        comm.CommandText = "Insert into Студент (Фамилия, Имя, Отчество, [№ группы], Пароль, [Ссылка на работы]) Values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + idGroup + "','1', '"+ path +"')";

                        DirectoryInfo drInfo = new DirectoryInfo(Application.StartupPath + dir + "Работы студентов\\" + textBox1.Text + " " + textBox2.Text + " " + textBox3.Text);
                        drInfo.Create();
                        //-----------------------------добавка с файлом history.txt---------------------
                        string temp=textBox1.Text + " " + textBox2.Text + " " + textBox3.Text;
                        File.Create(Application.StartupPath + dir + "Работы студентов\\" + temp + "\\" + temp + ".txt");
                    }   //-------------------------------------------------------------------------------
                    comm.ExecuteNonQuery();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString());
                }
                finally
                {
                    conn.Close();
                    this.Hide();
                }
            }
            else MessageBox.Show("Заполните все данные!");
        }
        public ActionResult RenameFolder(string currentName, string memberId, PersonalFolderIdFormats format)
        {
            string result = "ok";

            try
            {
                DirectoryInfo d = new DirectoryInfo(currentName);
                DirectoryMember m = _contextManager.DirectoryContext.DirectoryMembers.GetByID(memberId);

                string newName = LdapUserConfig.FormatFolderName(m, format);
                string thisPath = Path.GetDirectoryName(d.FullName);
                string newPath = Path.Combine(thisPath, newName);
                d.MoveTo(newPath);
            }
            catch(Exception ex)
            {
                ExceptionCollector ec = new ExceptionCollector(ex);
                result = ec.ToUL();
            }

            return Content(result);
        }
 private void button1_Click(object sender, EventArgs e)
 {
     if ((textBox1.Text != "") && (textBox2.Text != "") && (textBox3.Text != ""))
     {
         try
         {
             conn.Open();
             comm.Connection = conn;
             string nameDir = textBox1.Text + " " + textBox2.Text + " " + textBox3.Text;
             string path = "\\General\\" + nameDir + "\\";
             if (type == "update")
             {
                 //изменяем название папки
                 string dir = getPrepodPuth(id);
                 string oldFolder = Application.StartupPath + dir;
                 string newFolder = Application.StartupPath + "\\General\\" + nameDir;
                 DirectoryInfo drInfo = new DirectoryInfo(oldFolder);
                 drInfo.MoveTo(newFolder);
                 comm.CommandText = "update Преподаватель set Фамилия = '" + textBox1.Text + "', Имя = '" + textBox2.Text + "', Отчество = '" + textBox3.Text + "', [Путь к папке] = '"+ path +"' where [№ преподавателя] = '" + id + "'";
             }
             else
             {
                 comm.CommandText = "Insert into Преподаватель (Фамилия, Имя, Отчество, Пароль, [Путь к папке]) Values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','12345', '"+ path +"')";
             }
             comm.ExecuteNonQuery();
         }
         catch (Exception exc)
         {
             MessageBox.Show(exc.Message.ToString());
         }
         finally
         {
             conn.Close();
             createDir();
             this.Hide();
         }
     }
     else MessageBox.Show("Заполните все данные!");
 }
        public bool Rename(string oldDir, string newDir)
        {
            if (string.IsNullOrEmpty(oldDir)) throw new ArgumentNullException("oldDir");
            if (string.IsNullOrEmpty(newDir)) throw new ArgumentNullException("newDir");

            string oldPath = Path.Combine(BaseDir, oldDir);
            var directoryInfoOldDir = new DirectoryInfo(oldPath);
            if (!directoryInfoOldDir.Exists) {
                throw new DirectoryNotFoundException("oldDir '" + oldPath + "' does not exist!");
            }

            string destination = Path.Combine(DestinationDir, newDir);

            bool result = false;

            if (!new DirectoryInfo(destination).Exists) {
                directoryInfoOldDir.MoveTo(destination);
                result = new DirectoryInfo(destination).Exists;
            }

            return result;
        }
        public void Run()
        {
            string destination = @"C:\destination";
            string source = @"C:\source";

            if (Directory.Exists(destination))
                Directory.Delete(destination);

            if (!Directory.Exists(source))
                Directory.CreateDirectory(source);

            Directory.Move(source, destination);

            if (Directory.Exists(destination))
                Directory.Delete(destination);

            if (!Directory.Exists(source))
                Directory.CreateDirectory(source);

            var directoryInfo = new DirectoryInfo(source);
            directoryInfo.MoveTo(destination);
        }
		/// <summary>
		/// Move a successfully uploaded WER into the landing zone folder
		/// </summary>
		/// <param name="SourceDirInfo">Temporary directory WER was uploaded to</param>
		/// <param name="ReportId">Unique ID of the report, used as the folder name in the landing zone</param>
		public void ReceiveReport(DirectoryInfo SourceDirInfo, string ReportId)
		{
			string ReportPath = Path.Combine(Directory, ReportId);

			// Recreate the landing zone directory, just in case.
			System.IO.Directory.CreateDirectory( Directory );

			DirectoryInfo DirInfo = new DirectoryInfo(ReportPath);
			if (DirInfo.Exists)
			{
				DirInfo.Delete(true);
				DirInfo.Refresh();
			}

			// Retry the move in case the OS keeps some locks on the uploaded files longer than expected
			for (int Retry = 0; Retry != MoveUploadedReportRetryAttempts; ++Retry)
			{
				try
				{
					SourceDirInfo.MoveTo(DirInfo.FullName);
					break;
				}
				catch (Exception)
				{
				}
				System.Threading.Thread.Sleep(100);
			}

			CrashReporterReceiverServicer.WriteEvent( "A new report has been received into " + DirInfo.FullName );

			ReceivedReports[ReportId] = DateTime.Now;

			// Ensure the receive reports memo file doesn't grow indefinitely
			ForgetOldReports();

			// Update file on disk, in case service is restarted
			MemorizeReceivedReports();
		}
Example #29
0
 public static bool CheckNoImdb(DirectoryInfo dirInfo)
 {
     bool deleteNoImdb =
         Convert.ToBoolean(ConfigReader.GetConfig("imdbTop250DeleteNoImdb"));
     string name = dirInfo.Name;
     if ( deleteNoImdb )
     {
         Log.DebugFormat("Directory Deleted '{0}'", dirInfo.FullName);
         dirInfo.Delete(true);
     }
     else
     {
         string path = ConfigReader.GetConfig("imdbTop250MoviesPath");
         string head = ConfigReader.GetConfig("imdbTop250NoIMDB");
         String newDir = String.Format(CultureInfo.InvariantCulture,
             "{0}\\{1}{2}", path, head, name);
         Log.DebugFormat("Directory Renamed '{0}' -> '{1}'", dirInfo.FullName, newDir);
         dirInfo.MoveTo(newDir);
     }
     //find and delete symlinks if any
     FindAndRemoveFolder(ConfigReader.GetConfig("imdbTop250SymlinkPath"), name);
     return true;
 }
Example #30
0
 private void listView1_AfterLabelEdit(object sender, LabelEditEventArgs e)
 {
     try
     {
         string MyPath = bc.Mpath() + "\\" + listView1.SelectedItems[0].Text;
         string newFilename = e.Label;
         string path2 = bc.Mpath() + "\\" + newFilename;
         if (File.Exists(MyPath))
         {
             if (MyPath != path2)
             {
                 File.Move(MyPath, path2);
             }
         }
         if (Directory.Exists(MyPath))
         {
             DirectoryInfo di = new DirectoryInfo(MyPath);
             di.MoveTo(path2);
         }
         listView1.Items.Clear();
         bc.GetListViewItem(bc.Mpath(), imageList1, listView1);
     }
     catch { }
 }
Example #31
0
 public void MoveTo(string destDirName)
 {
     _inner.MoveTo(destDirName);
 }
Example #32
0
 public static void MoveTo(this DirectoryInfo Directory, DirectoryInfo Destination) => Directory.MoveTo(Destination.FullName);
 /// <summary>
 /// 
 /// </summary>
 /// <param name="filePath"></param>
 /// <param name="newName"></param>
 /// <returns></returns>
 public bool ModifyDirectoryName(string path, string oldName, string newName)
 {
     if (oldName.Equals(newName)) return true;
     DirectoryInfo directory1 = new DirectoryInfo(path);
     DirectoryInfo directory2 = new DirectoryInfo(path.Replace(oldName, newName));
     if (directory1.Exists)
         directory1.MoveTo(path.Replace(oldName, newName));
     else
         directory2.Create();
     return true;
 }
        public static DirectoryStatus RemoveJunction(string junctionPath, string rootOriginalPath, string rootBackupPath)
        {
            DirectoryInfo linkDirectory = new DirectoryInfo(junctionPath);
            DirectoryInfo actualDirectory = new DirectoryInfo(GetBackupPath(junctionPath, rootOriginalPath, rootBackupPath));

            if (linkDirectory.Attributes.HasFlag(FileAttributes.ReparsePoint) && FoldersActuallyMatch(linkDirectory, actualDirectory, true))
            {
                // Delete the junction directory
                linkDirectory.Delete(true);

                if (linkDirectory.FullName.StartsWith(actualDirectory.FullName.Substring(0, 3)))
                {
                    actualDirectory.MoveTo(junctionPath);
                }
                else
                {
                    CopyDirectory(actualDirectory.FullName, junctionPath);

                    foreach (var file in Directory.EnumerateDirectories(actualDirectory.FullName).Concat(new[] { actualDirectory.FullName }).SelectMany(Directory.EnumerateFiles))
                    {
                        FileInfo fileInfo = new FileInfo(file);
                        fileInfo.IsReadOnly = false;
                    }

                    actualDirectory.Delete(true);
                }
            }

            return GetDirectoryStatus(junctionPath, rootOriginalPath, rootBackupPath);
        }
 protected void RenameDir(string path, string name)
 {
     CheckPath(path);
     DirectoryInfo source = new DirectoryInfo(FixPath(path));
     DirectoryInfo dest = new DirectoryInfo(Path.Combine(source.Parent.FullName, name));
     if(source.FullName == GetFilesRoot())
         throw new Exception(LangRes("E_CannotRenameRoot"));
     else if (!source.Exists)
         throw new Exception(LangRes("E_RenameDirInvalidPath"));
     else if (dest.Exists)
         throw new Exception(LangRes("E_DirAlreadyExists"));
     else
     {
         try
         {
             source.MoveTo(dest.FullName);
             _r.Write(GetSuccessRes());
         }
         catch
         {
             throw new Exception(LangRes("E_RenameDir") + " \"" + path + "\"");
         }
     }
 }
Example #36
0
        }     //method

        public void DownloadCover(Av av)
        {
            Match match = new Regex(@"<a class=""bigImage"" href=""(?<url>.*?)"">").Match(av.Html);

            if (match.Success)
            {
                string url = match.Groups["url"].Value;
                Download.HttpDownloadFile(url, av.Path + "\\", "art.jpg");
                //int fg = url.LastIndexOf("/") + 1;
                //string name = url.Substring(fg, url.Length - fg - 6).Trim();
                url = url.Replace("_b", "");
                string qb = "<li class=\"active\"><a href=\"" + basePath + "/\">";
                if (av.Html.IndexOf(qb) != -1)
                {
                    url = url.Replace("cover", "thumb");
                }
                else
                {
                    url = url.Replace("cover", "thumbs");
                }

                Download.HttpDownloadFile(url, av.Path + "\\", "folder.jpg");

                //修改文件夹名称
                try
                {
                    StringBuilder   sb         = new StringBuilder();
                    MatchCollection startNames = new Regex(@"<div class=""star-name""><a href="".*?"" title="".*?"">(?<name>.*?)</a></div>").Matches(av.Html);
                    int             i          = 0;
                    int             x          = 0;
                    int             y          = 0;
                    foreach (Match m in startNames)
                    {
                        sb.Append(m.Groups["name"].Value);
                        i++;
                        if (i < startNames.Count)
                        {
                            sb.Append(",");
                        }
                        if (++x > 20)
                        {
                            y++; x = 0;
                            File.Create(av.Path + "\\" + av.Id + " " + sb.ToString() + ".star" + y + ".txt").Close();
                            sb.Clear();
                        }
                    }
                    if (sb.Length > 0)
                    {
                        File.Create(av.Path + "\\" + av.Id + " " + sb.ToString() + ".star" + (y == 0?"":y + 1 + "") + ".txt").Close();
                    }
                }
                catch (Exception e)
                {
                    _syncContext.Post(OutError, av.Id + " :获取女优失败");
                }

                try
                {
                    //match = new Regex(@"<h3>(?<title>.*?)</h3>[\s\S]*?<p><span class=""header"">發行日期:</span>(?<date>.*?)</p>").Match(av.Html);
                    match = new Regex(@"<h3>(?<title>[\s\S]*?)</h3>[\s\S]*?<p><span class=""header"">發行日期:</span>(?<date>.*?)</p>").Match(av.Html);
                    string newPath = null;
                    if (match.Success)
                    {
                        string newfolderName = match.Groups["date"].Value.Trim() + " " + match.Groups["title"].Value.Trim();
                        newfolderName = newfolderName.Replace("\\", "‖");
                        newfolderName = newfolderName.Replace("/", "‖");
                        newfolderName = newfolderName.Replace(":", ":");
                        newfolderName = newfolderName.Replace("*", "※");
                        newfolderName = newfolderName.Replace("?", "?");
                        newfolderName = newfolderName.Replace("<", "〈");
                        newfolderName = newfolderName.Replace(">", "〉");
                        newfolderName = newfolderName.Replace("\n", " ");
                        newfolderName = newfolderName.Replace("\r", " ");
                        //newfolderName = Regex.Replace(newfolderName, @"[/n/r]", " ");

                        StringBuilder rBuilder = new StringBuilder(newfolderName);
                        foreach (char rInvalidChar in Path.GetInvalidPathChars())
                        {
                            rBuilder.Replace(rInvalidChar.ToString(), string.Empty);
                        }

                        int    fg       = av.Path.LastIndexOf("\\");
                        string basePath = av.Path.Substring(0, fg).Trim();
                        System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(av.Path);
                        folder.MoveTo(basePath + "\\" + newfolderName);
                        newPath = basePath + "\\" + newfolderName;
                    }
                    else
                    {
                        ExeLog.WriteLog("获取AV名称失败:\r\n" + av.Html);
                        _syncContext.Post(OutError, av.Id + " :获取AV名称失败");
                        return;
                    }

                    //修改视频名称 改为符合 emby的规则
                    string[]      extNames = new string[] { ".avi", ".mov", ".mpg", ".RA", ".RM", ".RMVB", ".WMV", ".mkv", ".mp4", ".asf", ".m4v", ".VOB" };
                    DirectoryInfo fdir     = new DirectoryInfo(newPath);
                    FileInfo[]    file     = fdir.GetFiles();
                    if (file.Length != 0)
                    { //当前目录文件或文件夹不为空
                        for (int i = 0; i < extNames.Length; i++)
                        {
                            int x = 0;
                            foreach (FileInfo f in file)
                            {
                                if (extNames[i].ToLower().Equals(f.Extension.ToLower()))
                                {
                                    x++;
                                }
                            }
                            int y = 1;
                            foreach (FileInfo f in file) //显示当前目录所有文件
                            {
                                if (extNames[i].ToLower().Equals(f.Extension.ToLower()))
                                {
                                    string newName = newPath + "\\" + av.Id + (x > 1 ? "-cd" + y : "") + f.Extension;
                                    try
                                    {
                                        //记录文件名称
                                        ChangeNameLogTxt(f.Name, newName);
                                        File.Move(f.FullName, newName);
                                        //File.Create(folder + "\\"+ (x > 1 ? "-cd" + y : "") + f.Name + ".old.name").Close();
                                    }
                                    catch (Exception ex)
                                    {
                                        _syncContext.Post(OutError, av.Id + "-修改视频文件名称错误 \r\n");
                                    }
                                    y++;
                                } //for files
                            }
                        }         //for ext
                    }             //file
                }
                catch (Exception e)
                {
                    _syncContext.Post(OutError, av.Id + " :修改AV名称失败" + e.Message);
                }


                _syncContext.Post(OutLog, av.Id);
            }
        }
Example #37
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //compute only on refresh
            if (FDir.PinIsChanged ||
                FCreate.PinIsChanged ||
                FDelete.PinIsChanged ||
                FNewDir.PinIsChanged ||
                FRename.PinIsChanged)
            {
                string currentDir;
                double currentCreate;
                double currentDelete;
                string curNewDir;
                double currentRename;

                FExists.SliceCount = SpreadMax;

                //loop for all slices
                for (int i = 0; i <= SpreadMax; i++)
                {
                    FDir.GetString(i, out currentDir);
                    FCreate.GetValue(i, out currentCreate);
                    FDelete.GetValue(i, out currentDelete);
                    FNewDir.GetString(i, out curNewDir);
                    FRename.GetValue(i, out currentRename);

                    string hostPath;
                    FHost.GetHostPath(out hostPath);
                    hostPath = Path.GetDirectoryName(hostPath);


                    if (!Path.IsPathRooted(currentDir))
                    {
                        currentDir = Path.Combine(hostPath, currentDir);
                    }

                    System.IO.DirectoryInfo curDirectory = new System.IO.DirectoryInfo(currentDir);

                    if (!curDirectory.Exists)
                    {
                        if (currentCreate == 1)
                        {
                            curDirectory.Create();
                            FExists.SetValue(i, 1.0);
                        }
                        else
                        {
                            FExists.SetValue(i, 0.0);
                        }
                    }
                    else
                    {
                        if (currentDelete == 1)
                        {
                            curDirectory.Delete();
                            FExists.SetValue(i, 0.0);
                        }
                        else
                        {
                            if (currentRename == 1)
                            {
                                if (!Path.IsPathRooted(curNewDir))
                                {
                                    curNewDir = Path.Combine(hostPath, curNewDir);
                                }
                                curDirectory.MoveTo(curNewDir);
                                FExists.SetValue(i, 0.0);
                            }
                            else
                            {
                                FExists.SetValue(i, 1.0);
                            }
                        }
                    }
                }
            }
        }
Example #38
0
 public void MoveTo(string destDirName)
 {
     _directoryInfo.MoveTo(destDirName);
 }
Example #39
0
        }     //method

        public void DownloadCover(Av av)
        {
            //MatchCollection matchs = new Regex(@"class=""responsive""\s+src=""(?<upload>.*?)""/>", RegexOptions.Multiline).Matches(av.Html);
            MatchCollection matchs = new Regex(@"class=""responsive""\s+src=""(?<upload>.*?)""\s*/>", RegexOptions.Multiline).Matches(av.Html);
            int             s      = 0;

            foreach (Match match in matchs)
            {
                string url = match.Groups["upload"].Value;
                Download.HttpDownloadFile(basePath + url, av.Path + "\\", s == 0 ? "poster.jpg" : "screenshot" + s + ".jpg");
                s++;
            }

            Match m = new Regex(@"<a\shref=""(.*?)""\starget=""_blank""\s><img\sid=""thumbpic""").Match(av.Html);

            if (m.Success)
            {
                string url = m.Groups[1].Value;
                Download.HttpDownloadFile(basePath + url, av.Path + "\\", "screenshot.jpg");
            }

            m = new Regex(@"<h5><strong style=""color:red;"">女优名字</strong>:<a href="".*?"">(.*?)</a></h5>
", RegexOptions.Singleline).Match(av.Html);
            if (m.Success)
            {
                string name = fileNameX(m.Groups[1].Value);
                File.Create(av.Path + "\\" + av.Id + " " + name + ".star.txt").Close();
            }

            m = new Regex(@"<h5><strong style=""color:red;"">卖家信息</strong>:<a href="".*?"">(.*?)</a>", RegexOptions.Singleline).Match(av.Html);
            if (m.Success)
            {
                string name = fileNameX(m.Groups[1].Value);
                File.Create(av.Path + "\\" + av.Id + " " + name + ".seller.txt").Close();
            }

            string newPath = null;

            try
            {
                Match nameMatch = new Regex(@"<div class=""col-sm-8"">\s+<h3>(.*?)</h3>", RegexOptions.Singleline).Match(av.Html);
                if (nameMatch.Success)
                {
                    string newfolderName           = fileNameX(nameMatch.Groups[1].Value);
                    int    fg                      = av.Path.LastIndexOf("\\");
                    string basePath                = av.Path.Substring(0, fg).Trim();
                    System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(av.Path);
                    if (!Directory.Exists(basePath + "\\ok"))
                    {
                        Directory.CreateDirectory(basePath + "\\ok");
                    }
                    folder.MoveTo(basePath + "\\ok\\" + newfolderName);
                    newPath = basePath + "\\ok\\" + newfolderName;
                }
                else
                {
                    ExeLog.WriteLog("获取AV名称失败:\r\n" + av.Html);
                    _syncContext.Post(OutError, av.Id + " :获取AV名称失败");
                    return;
                }

                //修改视频名称 改为符合 emby的规则
                string[]      extNames = new string[] { ".avi", ".mov", ".mpg", ".RA", ".RM", ".RMVB", ".WMV", ".mkv", ".mp4", ".asf", ".m4v", ".VOB" };
                DirectoryInfo fdir     = new DirectoryInfo(newPath);
                FileInfo[]    file     = fdir.GetFiles();
                if (file.Length != 0)
                {     //当前目录文件或文件夹不为空
                    for (int i = 0; i < extNames.Length; i++)
                    {
                        int x = 0;
                        foreach (FileInfo f in file)
                        {
                            if (extNames[i].ToLower().Equals(f.Extension.ToLower()))
                            {
                                x++;
                            }
                        }
                        int y = 1;
                        foreach (FileInfo f in file)     //显示当前目录所有文件
                        {
                            if (extNames[i].ToLower().Equals(f.Extension.ToLower()))
                            {
                                string newName = newPath + "\\" + av.Id + (x > 1 ? "-cd" + y : "") + f.Extension;
                                try
                                {
                                    //记录文件名称
                                    ChangeNameLogTxt(f.Name, newName);
                                    File.Move(f.FullName, newName);
                                    //File.Create(folder + "\\"+ (x > 1 ? "-cd" + y : "") + f.Name + ".old.name").Close();
                                }
                                catch (Exception ex)
                                {
                                    _syncContext.Post(OutError, av.Id + "-修改视频文件名称错误 \r\n");
                                }
                                y++;
                            } //for files
                        }
                    }         //for ext
                }             //file
            }
            catch (Exception e)
            {
                _syncContext.Post(OutError, av.Id + " :修改AV名称失败" + e.Message);
            }


            //_syncContext.Post(OutLog, av.Id);
            //}
        }
Example #40
0
        }     //method

        public void DownloadCover(Av av)
        {
            Match match = new Regex(@"<img id=""video_jacket_img"" src=""//(?<url>.*?)""").Match(av.Html);

            if (match.Success)
            {
                string url = match.Groups["url"].Value;
                url = "http://" + url;
                Download.HttpDownloadFile(url, av.Path + "\\", "art.jpg");
                url = url.Replace("pl.jpg", "ps.jpg");
                Download.HttpDownloadFile(url, av.Path + "\\", "folder.jpg");

                //修改文件夹名称
                try
                {
                    StringBuilder sb             = new StringBuilder();
                    Match         startNameMatch = new Regex(@"<td class=""header"">演员:</td>\s*<td class=""text"">(?<name>.*?)</td>").Match(av.Html);
                    if (startNameMatch.Success)
                    {
                        string startName = ReplaceHtmlTag(startNameMatch.Groups["name"].Value);
                        if (startName.Length > 100)
                        {
                            string[] startNames = startName.Trim().Split(' ');
                            int      x          = 0;
                            int      y          = 0;
                            foreach (string n in startNames)
                            {
                                if (++x > 20)
                                {
                                    y++; x = 0;
                                    File.Create(av.Path + "\\" + av.Id + " " + sb.ToString() + ".star" + y + ".txt").Close();
                                    sb.Clear();
                                }
                            }
                            if (sb.Length > 0)
                            {
                                File.Create(av.Path + "\\" + av.Id + " " + sb.ToString() + ".star" + (y == 0 ? "" : y + 1 + "") + ".txt").Close();
                            }
                        }
                        else
                        {
                            File.Create(av.Path + "\\" + av.Id + " " + startName.Trim().Replace(' ', ',') + ".star.txt").Close();
                        }
                    }
                }
                catch (Exception e)
                {
                    _syncContext.Post(OutError, av.Id + " :获取女优失败");
                }

                try
                {
                    //match = new Regex(@"<h3>(?<title>.*?)</h3>[\s\S]*?<p><span class=""header"">發行日期:</span>(?<date>.*?)</p>").Match(av.Html);
                    match = new Regex(@"<div id=""video_title""><h3 class=""post-title text""><a.*?>(?<title>.*?)</a></h3>[.\s\S]*<td class=""header"">发行日期:</td>\s*<td class=""text"">(?<date>.*?)</td>
").Match(av.Html);
                    if (match.Success)
                    {
                        string newfolderName = match.Groups["date"].Value.Trim() + " " + match.Groups["title"].Value.Trim();
                        newfolderName = newfolderName.Replace("\\", "‖");
                        newfolderName = newfolderName.Replace("/", "‖");
                        newfolderName = newfolderName.Replace(":", ":");
                        newfolderName = newfolderName.Replace("*", "※");
                        newfolderName = newfolderName.Replace("?", "?");
                        newfolderName = newfolderName.Replace("<", "〈");
                        newfolderName = newfolderName.Replace(">", "〉");
                        newfolderName = newfolderName.Replace("\n", " ");
                        newfolderName = newfolderName.Replace("\r", " ");
                        //newfolderName = Regex.Replace(newfolderName, @"[/n/r]", " ");

                        StringBuilder rBuilder = new StringBuilder(newfolderName);
                        foreach (char rInvalidChar in Path.GetInvalidPathChars())
                        {
                            rBuilder.Replace(rInvalidChar.ToString(), string.Empty);
                        }

                        int    fg       = av.Path.LastIndexOf("\\");
                        string basePath = av.Path.Substring(0, fg).Trim();
                        System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(av.Path);
                        folder.MoveTo(basePath + "\\" + newfolderName);
                    }
                    else
                    {
                        ExeLog.WriteLog("获取AV名称失败:\r\n" + av.Html);
                        _syncContext.Post(OutError, av.Id + " :获取AV名称失败");
                    }
                }
                catch (Exception e)
                {
                    _syncContext.Post(OutError, av.Id + " :修改AV名称失败");
                }


                _syncContext.Post(OutLog, av.Id);
            }
        }