Skip to content
Geiszl András edited this page Sep 20, 2015 · 6 revisions

Remove old photos

using System.Collections.Generic;
using System.Linq;

List<iDevice> devices = iOSLib.GetDevices();
devices[0].Connect();
devices[0].GetPhotos();

DateTime lastYear = DateTime.Now.AddYears(-1);
List<Photo> removeList = devices[0].Photos.PhotoList
    .Where(x => x.CreationTime < lastYear).ToList();
devices[0].Photos.RemovePhotos(removeList);

devices[0].Disconnect();

Save photos from a specific album

using System.Collections.Generic;
using System.Linq;

List<iDevice> devices = iOSLib.GetDevices();
devices[0].Connect();
devices[0].GetPhotos();

List<Photo> saveList = devices[0].Photos.PhotoList
    .Where(x => x.AlbumList.Any(y => y.Name == "Instagram")).ToList();
devices[0].Photos.SavePhotos(saveList, @"C:\Users\user\Desktop\Saved\");

devices[0].Disconnect();

Save photos to separate folders by creation date

using System.Collections.Generic;
using System.Linq;

List<iDevice> devices = iOSLib.GetDevices();
devices[0].Connect();
devices[0].GetPhotos();

string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var groupedPhotoList = devices[0].Photos.PhotoList.GroupBy(x => x.CreationTime,
    (key, y) => new { date = key.Date, photos = y.ToList() });
foreach (var photosByAlbum in groupedPhotoList)
{
    devices[0].Photos.SavePhotos(photosByAlbum.photos,
        desktopPath + @"\Saved\" + photosByAlbum.date.ToString("d").Replace("/", "_"));
}

devices[0].Disconnect();

Home
iOSLib
iDevice

  • Constructor
  • Variables
  • Functions

Photos

  • Constructor
  • Variables
  • Functions

Photo

  • Variables
  • Functions

Album

  • Variables

Examples

Photos.sqlite Tables (in iOS 8.4)

Clone this wiki locally