Guest User

Untitled

a guest
Jul 21st, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. static void Main(string[] args)
  2. {
  3. string downann = @"downloads\";
  4. string homepath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
  5. string downloadsdir = string.Format(@"{0}\{1}", homepath, downann);
  6.  
  7. DirectoryInfo downloadsinf = new DirectoryInfo(downloadsdir);
  8.  
  9. foreach (System.IO.DirectoryInfo gi in downloadsinf.GetDirectories())
  10. if isFolderSolid(gi , ".jpg") {
  11. // move it to pictures
  12. }
  13. if isFolderSolid(gi , ".avi") {
  14. // move it to movies
  15. }
  16.  
  17. }
  18.  
  19. private void isFolderSolid(System.IO.DirectoryInfo gi, String type) {
  20. foreach (FileInfo fi in gi.GetFiles())
  21. {
  22.  
  23. //TODO add a check to make sure gi has at least one file
  24.  
  25. name = fi.FullName()
  26. if (name.SubString(name.Length-3,3) != type)
  27. return false;
  28. }
Add Comment
Please, Sign In to add comment