Skip to content

Instantly share code, notes, and snippets.

@aloisdg
Created March 7, 2019 10:37
Show Gist options
  • Save aloisdg/1c95c8f9c6e13ba0528eed6bb7e485d2 to your computer and use it in GitHub Desktop.
Save aloisdg/1c95c8f9c6e13ba0528eed6bb7e485d2 to your computer and use it in GitHub Desktop.
// source: https://www.tekrevue.com/tip/find-windows-spotlight-lock-screen-images-windows-10/
let (</>) path1 path2 = System.IO.Path.Combine (path1, path2)
let toJpg x = x + ".jpg"
let copyTo dest from = System.IO.File.Copy(from, dest) |> ignore
// let assetPath = """.\%LocalAppData%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"""
let localAppData = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData)
let pathToAssets = localAppData </> """Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets"""
let myPictures = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures)
let pathToBing = myPictures </> "LockScreenPictures"
pathToBing |> System.IO.Directory.CreateDirectory |> ignore
System.IO.DirectoryInfo(pathToAssets).GetFiles "*"
|> Array.filter (fun x -> x.Length > int64 10000) // |> Array.sortByDescending(fun x -> x.Length)
|> Array.iter (fun x -> x.FullName |> copyTo (pathToBing </> (toJpg x.Name)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment