# In my Panel class I use:

col.prop(context.scene, 'path')


# I also have:

def register():
bpy.utils.register_class(PBRGROUP)
bpy.utils.register_module(__name__)
bpy.types.Scene.path = bpy.props.StringProperty \
(
name = "Folder with textures",
default = "",
description = "Select folder with images to import",
subtype = 'DIR_PATH'
)

def unregister():
bpy.utils.unregister_class(PBRGROUP)
bpy.utils.unregister_module(__name__)
del bpy.types.Scene.path


# The above gives me:

How to add all images from selected folder to my .blend file?

I know how to create a button, but I don't know how to add files from directory.

You can add an adapted version of this nice generator to your code to find all images in a given folder (such as the ones you keep in your Scene.path property):

import bpy, os
def path_iterator(folder_path):
for fp in os.listdir(folder_path):
if fp.endswith( tuple( bpy.path.extensions_image ) ):
yield fp


Then you can iterate over the images and do whatever you want with them, for instance to add them to the list of images blender can use for textures and other purposes:

for imgPath in path_iterator( bpy.context.scene.path ):
fullPath = os.path.join( bpy.context.scene.path, imgPath )
bpy.ops.image.open( filepath = fullPath )

• you can use fp.endswith(('.png', '.jpg', '.tif', '.hdr')) , feed it a tuple. – zeffii Oct 14 '15 at 10:37
• Nice,didn't know that. – TLousky Oct 14 '15 at 10:40
• @TLousky bpy.path.extesions_image is a set of all image formats supported (by extension) – batFINGER Oct 14 '15 at 12:09
• @batFINGER awesome, will update the script accordingly. – TLousky Oct 14 '15 at 12:12
• if fp = "texnormal.png", then fp[-10:] = "normal.png". So the conditional fp[-10:] in ['normal'] will result with a False value (and the brackets [] shouldn't be there since you're testing for substrings within strings). You can reverse it to 'normal' in fp[-10:] which will work, or to fn[-10:-4] == 'normal'. – TLousky Oct 14 '15 at 13:11