Guest User

Code

a guest
Jan 29th, 2021
447
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11.  
  12. namespace FiveM_Converter
  13. {
  14. public partial class Form1 : Form
  15. {
  16. string folderPath;
  17.  
  18. public Form1()
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. private void browseFile_Click(object sender, EventArgs e)
  24. {
  25. DialogResult result = selectFolderDialog.ShowDialog();
  26. if (result == DialogResult.OK)
  27. {
  28. folderPath = selectFolderDialog.SelectedPath;
  29. }
  30. }
  31.  
  32. private void renameFile_Click(object sender, EventArgs e)
  33. {
  34. renameAllFiles(folderPath);
  35.  
  36. MessageBox.Show("Successfully renamed files", "Success", MessageBoxButtons.OK);
  37. }
  38.  
  39. private void renameAllFiles(string path)
  40. {
  41. DirectoryInfo dirInfo = new DirectoryInfo(path);
  42. FileInfo[] files = dirInfo.GetFiles();
  43. DirectoryInfo[] dirs = dirInfo.GetDirectories();
  44.  
  45. foreach (FileInfo file in files)
  46. {
  47. File.Move(file.FullName, file.Directory.FullName + "\\" + file.Directory.Name + "^" + file.Name);
  48. }
  49.  
  50. foreach(DirectoryInfo dir in dirs)
  51. {
  52. renameAllFiles(dir.FullName);
  53. }
  54. }
  55. }
  56. }
RAW Paste Data