diff --git a/renderer/render-test-case b/renderer/render-test-case
index ef0a47ca5c5cdaec3c3138bc0fdd778fdf6e47c9..3748f8abecd0dd438cebc987da5bdc3030fd1246 100755
--- a/renderer/render-test-case
+++ b/renderer/render-test-case
@@ -28,6 +28,22 @@ from argparse import ArgumentParser
 from renderer import generate_test_case
 
 
+def copy_files(directory, dirname, msg):
+    """
+    Only copy files if destination directory (dst_dir) is not in the cwd.
+    """
+    dst_dir = os.path.join(directory, dirname)
+    if dst_dir != os.path.join(os.getcwd(), dirname):
+        if not os.path.isdir(dst_dir):
+            print("Creating directory", dst_dir)
+            os.mkdir(dst_dir)
+
+        print(msg, dst_dir)
+        files = os.listdir(dirname)
+        for f in files:
+            shutil.copy2(os.path.join(dirname, f), dst_dir)
+
+
 if '__main__' == __name__:
     cli_parser = ArgumentParser(description="render-test-case")
     cli_parser.add_argument('-d', '--test-case-dir',
@@ -36,7 +52,7 @@ if '__main__' == __name__:
                             help="YAML file or files directory")
     args = cli_parser.parse_args()
 
-    directory = '.'
+    directory = os.getcwd()
     if args.test_case_dir:
         directory = args.test_case_dir
         try:
@@ -60,12 +76,5 @@ if '__main__' == __name__:
         print("Total of test cases processed:", c)
 
     # Copy CSS and images directory
-    cssdir = os.path.join(directory, 'css')
-    if not (os.path.exists(cssdir) and os.path.isdir(cssdir)):
-        print("Copying css style to", cssdir)
-        shutil.copytree('css/', cssdir)
-
-    imagesdir = os.path.join(directory, 'images')
-    if not (os.path.exists(imagesdir) and os.path.isdir(imagesdir)):
-        print("Copying images to", imagesdir)
-        shutil.copytree('images/', imagesdir)
+    copy_files(directory, 'css/', "Copying css style to")
+    copy_files(directory, 'images/', "Copying images to")