-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (40 loc) · 1.34 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.IO;
using MetadataExtractor;
using System.Linq;
using MetadataExtractor.Formats.Exif;
namespace image_organizer
{
class Program
{
static int Main(string[] args)
{
if (args == null || args.Length == 0
|| string.IsNullOrWhiteSpace(args[0])
|| string.IsNullOrWhiteSpace(args[1]))
{
Console.WriteLine("Missing input and/or output directory arguments.");
Console.WriteLine("Usage: ImageOrganizer inputDir outputDir");
return (int)ExitCode.InvalidDirectoryName;
}
Console.WriteLine("input dir: " + args[0]);
Console.WriteLine("output dir: " + args[1]);
var inputDir = new DirectoryInfo(args[0]);
var outputDir = new DirectoryInfo(args[1]);
if (!outputDir.Exists)
{
Console.WriteLine("Output directory did not exist. Creating it now.");
outputDir.Create();
}
new FileManager().ProcessDirectory(inputDir, outputDir);
return (int)ExitCode.Success;
}
}
enum ExitCode : int
{
Success = 0,
InvalidDirectoryName = 2,
UnknownError = 10
}
}