Created
April 25, 2016 15:57
-
-
Save alfonsogarciacaro/787af243d3c077a7feb427a278b59881 to your computer and use it in GitHub Desktop.
Script to compare existing versions of Android image resources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System | |
open System.IO | |
let sep = ";" | |
let resultsFile = __SOURCE_DIRECTORY__ + "/results.csv" | |
let resourcePath = "/Users/alfonsogarciacaronunez/Documents/Github/mobile/Joey/Resources" | |
let limit = DateTime.Today.AddDays(-10.) | |
let set = System.Collections.Generic.HashSet<string>() | |
let dic = System.Collections.Generic.Dictionary<string,(string list)>() | |
Directory.GetDirectories resourcePath | |
|> Seq.filter (fun x -> x.Contains "drawable") | |
|> Seq.iter (fun path -> | |
let dir = Path.GetFileName(path) | |
set.Add(dir) |> ignore | |
Directory.GetFiles path | |
|> Seq.filter (fun x -> | |
(File.GetLastWriteTimeUtc x) > limit | |
&& Path.GetExtension(x) = ".png") | |
|> Seq.map Path.GetFileName | |
|> Seq.iter (fun file -> | |
if not (dic.ContainsKey file) then | |
dic.Add(file, []) | |
dic.[file] <- dir::dic.[file]) | |
) | |
// Printing | |
File.WriteAllLines(resultsFile, | |
[| | |
yield sprintf "File%s%s" sep (String.concat sep set) | |
for k in dic.Keys |> Seq.sort do | |
yield set | |
|> Seq.map (fun x -> if List.contains x dic.[k] then "O" else "X") | |
|> String.concat sep | |
|> sprintf "%s%s%s" k sep | |
|]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment