-
Notifications
You must be signed in to change notification settings - Fork 61
/
Photos.R
26 lines (19 loc) · 933 Bytes
/
Photos.R
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
# Create a "photos" directory (Warnings ignored so if it already exists it will safely continue)
# Create a "photos" directory
dir.create( "photos", showWarnings = FALSE )
# Create a directory for the individual's photos
dir.create( paste("photos",individual.id, sep="/"), showWarnings = FALSE )
# Download each of the individuals photos
for (i in 1:length(individual.photos.url)) {
download.file(individual.photos.url[i], individual.photos.file[i])
}
# Create a directory for the friends photos
dir.create( paste("photos","friends", sep="/"), showWarnings = FALSE )
# Download each friends photos
for (i in 1:length(friends.photos.url)) {
download.file(friends.photos.url[i], friends.photos.file[i])
}
# Nasty hack to call CentOS 'convert' command for when people have uploaded non-jpg files
system('for i in `ls photos/*/*.jpg`; do j=${i%.*}; convert $j.jpg $j.jpg; done', wait=TRUE)
# Cleanup temporary variables
rm(i)