デジタル一眼レフでは、JPGデータだけでなくRAWデータも記録できます。そのデータをパソコンに移すと、.JPG と .CR2 (こちらがRAWデータ) の2種類の拡張子を持つデータが保存されます。
.JPGのデータのみを別のフォルダ (Dropboxに作成したフォルダ) にコピーするスクリプトです:
This file contains 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
#current <- getwd() | |
setwd("/Users/***/Pictures/***") | |
files <- list.files(pattern="\\.JPG") | |
for (i in files){ | |
name <- paste("/Users/***/Dropbox/***/", i, sep="") | |
file.copy(i, name) | |
} | |
#setwd(current) |
- 2行目 setwd(): データを保存したフォルダーを作業ディレクトリに指定。
- 4行目 list.files(pattern="\\.JPG"): .JPGの拡張子を持つファイルの一覧を獲得し、filesに入れる。
- 6行目 paste("保存先フォルダ", i, sep=""): 保存先フォルダと保存名称を決め、nameに入れる。
- 7行目 file.copy(i, name): コピー。
.JPGで十分であればそのまま、不十分であればRAWデータを現像して上書き、という手順が便利です。
0 件のコメント:
コメントを投稿