Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var gid = ")))))";
var pid = -gid;
var photos = API.photos.get({
"owner_id": pid,
album_id: "wall",
rev: 0,
count: 24
});
var beforeCount = photos.count;
if (beforeCount <= 100) {
return "OK";
}
var result = {};
var deleted = [];
var i = 0;
var runFlag = true;
while (runFlag) {
if (i >= photos.items.length) {
runFlag = false;
} else {
var photoId = photos.items[i].id;
var del = API.photos.delete({
photo_id: photoId,
owner_id: pid
});
deleted.push(del);
i = i + 1;
if (i > photos.items.length) {
runFlag = false;
}
}
}
result.cnt = beforeCount;
result.results = deleted;
return result;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.