Lauren Hodgson
unread,Aug 30, 2012, 10:24:14 PM8/30/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to tropi...@googlegroups.com
Today I wanted to keep a subset of species map images I'd produced
from a folder, and delete the rest. The files were named as such:
Genus_species.png
My species names were in the format: Genus_species
unwanted.species = #a subset of species that you want to delete the files for
unwanted.files=paste(unwanted.species,'.png',sep='') #format species
names as image file names as they appear in your folder ie.
Genus_species.png
setwd('/home/jc148322/folder_with_files/'') #set the directory
unlink(unwanted.files) #delete the subset of files from the directory.