diff --git a/keywords.txt b/keywords.txt
index 91e74b8..c019f70 100644
--- a/keywords.txt
+++ b/keywords.txt
@@ -23,7 +23,7 @@ close	KEYWORD2
 seek	KEYWORD2
 position	KEYWORD2
 size	KEYWORD2	
-
+getUniqueFileName	KEYWORD2
 #######################################
 # Constants (LITERAL1)
 #######################################
diff --git a/src/SD.cpp b/src/SD.cpp
index b88c665..1775be0 100644
--- a/src/SD.cpp
+++ b/src/SD.cpp
@@ -569,6 +569,16 @@ boolean SDClass::remove(const char *filepath) {
   return walkPath(filepath, root, callback_remove);
 }
 
+String SDClass::getUniqueFileName(String expectedName, String expectedExtention)
+{
+  long counter = 0;
+  while (SD.exists(expectedName + String(counter) + "." + expectedExtention))
+  {
+    counter += 1;
+  }
+  return expectedName  + String(counter) + "." + expectedExtention;
+}
+
 
 // allows you to recurse into a directory
 File File::openNextFile(uint8_t mode) {
diff --git a/src/SD.h b/src/SD.h
index 7f41033..0719e3e 100644
--- a/src/SD.h
+++ b/src/SD.h
@@ -92,6 +92,9 @@ class SDClass {
   boolean rmdir(const char *filepath);
   boolean rmdir(const String &filepath) { return rmdir(filepath.c_str()); }
 
+//returns a unique name for the file with expectedfilename an extention.
+  String getUniqueFileName(String expectedName, String expectedExtention);
+
 private:
 
   // This is used to determine the mode used to open a file