I have downloaded several imagery Zip files (content of each is jp2, jpg, jpw, xml, htm, and .dbf, .prj, .sbn, .sbx, .shp, .shx) and would like to quickly add this imagery to my working project in QGIS 2.6.1. I am trying to avoid having to navigate to and add each file separately. Because each file is in a different folder, I have not been able to find a way to add multiple files at once.
What you need is the QGIS plugin Load Them All. Apart from loading files from several directories at once, you can:
- Reflect the directory structure in the QGIS Table of Contents (by means of nested layer groups).
- Apply alphanumeric filters so that you just load layers that match your filter (think of regular expressions).
- Load only certain geometry or raster type (e.g., only polygon vectors or Multiband rasters).
- Load only certain file extensions (e.g., only .shp files).
- Load only layers that lie inside or that intersect a given bounding box.
and more. Have a look at https://github.com/gacarrillor/loadthemall for more details.
As an alternative to using a plugin, you can give the Add Layer command a semicolon-delimited list of files. You can create such a list in the following manner:
cd /d <Path_to_the_directory_where_your_files_are> dir *.shp /s /b >All.txt
This gives you a file named
All.txt, which contains the paths to all the files with a specific extension (you can use a different mask depending on the files you have), where each file is on a new line.
D:\Data\01\data01_1.shp D:\Data\01\data01_2.shp D:\Data\02\data02_1.shp D:\Data\02\data02_2.shp
Then simply replace all newlines with
; using a text editor (like Notepad++) and paste the result in the
Add Vector Layer... dialog.
For Notepad++ you need to change the replace mode to Extended and replace
;. You would get a file that looks like this:
On Linux, you can extract a list of
.shp files and feed it directly into the "Import Vector" dialog:
#on the command line ls /home/yourpath/*/*shp|tr "\n" '@'|sed 's/@/" "/g'|sed 's/^/"/g'
I found this useful under QGIS Docker, beacuse for some reason the "Load Them All" plugin was not showing its dialog.