Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- string downann = @"downloads\";
- string homepath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
- string downloadsdir = string.Format(@"{0}\{1}", homepath, downann);
- DirectoryInfo downloadsinf = new DirectoryInfo(downloadsdir);
- foreach (System.IO.DirectoryInfo gi in downloadsinf.GetDirectories())
- if isFolderSolid(gi , ".jpg") {
- // move it to pictures
- }
- if isFolderSolid(gi , ".avi") {
- // move it to movies
- }
- }
- private void isFolderSolid(System.IO.DirectoryInfo gi, String type) {
- foreach (FileInfo fi in gi.GetFiles())
- {
- //TODO add a check to make sure gi has at least one file
- name = fi.FullName()
- if (name.SubString(name.Length-3,3) != type)
- return false;
- }
Add Comment
Please, Sign In to add comment