date.to.filename adds the current date of a file to the beginning or end of a file name.  E.g., if 'thisfile.doc' is currently dated 06/04/2012, then the file name is changed to '120604.thisfile.doc' or 'thisfile.120604.doc'.  The 'date.last' argument controls whether the date is prepended or appended to the file name without extension.  The function also applies to a vector of file names (with or without paths).  

The 'filenames' and 'path' arguments control which files will be renamed.  If 'filenames' designates a vector of file names, and 'path' is NULL, then the file dates will be added to or replace the filenames.  If 'filenames' is NULL and 'path' is a vector designating one or more paths, then the files in the directories that terminate the paths will have the dates added to the name or replace the name.  If 'filenames' is non-NULL and 'path' is non-NULL, then it is assumed that the filenames do not include a path specification and that 'path' designates the path specification for the files; in this case, the 'path' is pasted in front of the 'filenames'.  

'replace.names' is set to NA (default), but to leave it with this setting 'stop's the 'date.to.filename' function with an error message.  If 'replace.names = TRUE', then the file name will be replaced with a name that represents the date of the file.  E.g., if 'thisfile.doc' is currently dated 06/04/2012, then the file name is changed to '120604.00k.doc' if 'thisfile.doc' is the k-th file that is dated 06/04/2012.  If 'replace.names = FALSE', then the current file date is appended to the file name, in the form, e.g., 'filename.120604.jpg'.  

The function stops if the file date/time and the alphabetical ordering of the file names do not coincide among files with the same date.  This can be over-ridden by setting 'use.ctime.ord = TRUE', in which case the new file name is the ordered by ctime among files with the same date, or by setting 'use.alpha.ord = TRUE', in which case the new file name is order by the alphabetical ordering among files with the same date.  

start.vals is a k x 2 matrix of character strings (numbers expressed as character strings).  In row n, start.vals[ n, 1 ] is a ymd date, e.g., "120623", and start.vals[ n, 2 ] is the last used number assigned to a photo file with the date expressed by start.vals[ n, 1 ].  Typically, start.vals[ n, 2 ] is the date assigned to a photo file that was previously loaded onto the hard drive, e.g., if previously a file named "120623.14.jpg", the next download of photos with the ymd date "120623" should note that "14" was the last used number in the "120623" set - this forces the next download to start the enumeration at "120623.15.jpg".  

The 'infix' argument is used to insert any string between the date and the extension.  E.g., if 'infix = "sd880"', then the output file names will have the form "120623.sd880.01.jpg".