2019-10-28

Batch Rename File/Folder with C#

            // BATCH RENAME FOLDER
            System.IO.DirectoryInfo _dirAA = new System.IO.DirectoryInfo(@"C:\Users\rockymay\Downloads\ROCKY\xx\");
            foreach (System.IO.DirectoryInfo _dir in _dirAA.GetDirectories())
            {
               foreach(var _dir1 in _dir.GetDirectories())
                {
                    foreach (var _dir2 in _dir1.GetDirectories())
                    {
                        foreach (var _dir3 in _dir2.GetDirectories())
                        {
                            if (_dir3.Name.Contains("[BT-btt.com]"))
                            {

                                string _name = _dir3.Name.Replace("[BT-btt.com]", "");
                                string newpath = _dir2.FullName + "\\" + _name;
                                System.IO.Directory.Move(_dir3.FullName, newpath);
                                Console.Write("#");
                            }
                        }
                    }
                }
            }



            // BATCH RENAME FILE
            foreach (String filePath in Directory.GetFiles(@"C:\Users\rockymay\Downloads\ROCKY\xx\", "*.*", SearchOption.AllDirectories))
            {
                File.Move(filePath, filePath.Replace("[BT-btt.com]", ""));
                Console.Write("#");
            }

1 comment:

  1. This method is amazing. As well as their team aided us safe the first page search positions along with several key phrases. web design agencies milwaukee

    ReplyDelete

Setup VNC on Ubuntu 20.04

  sudo apt update sudo apt install xfce4 xfce4-goodies sudo apt install tigervnc-standalone-server sudo apt install tightvncserver vncserver...