No Code Required to Count Shapefiles or GIS Files in a Folder

No Code Required to Count Shapefiles or GIS Files in a Folder

There are different codes available in internet for counting GIS files but the method I am going to demonstrate you is simple and does not require any coding or no knowledge of python script. You just need few DOS command and Microsoft Excel software. You can do all kinds of analysis on excel sheet after importing list of shapefiles. On the below image you will notice I have different types of files; shapefiles, excel files and geodatabase files. So our target is to create a list of files with their name and extension in a excel sheet.

No coding required example

1. First step is to open the DOS command window, go to Start > All Programs > Accessories > Command Prompt on Windows 7 premium. Or shortcut way is to type CMD on the search box.

Command window

2. Now use the CD DOS command to add your directory (DOS basics). Note, use CD.. Command to clear directories. Below image shows the directory that I will be counting files.

CD added directory


3. Now type the dir /b > mylist.txt on the command window at the end and press Enter which will create mylist.txt files inside the shapefile folder. This txt file will be later imported to Excel.

CD added directory option 2


Few other Commands:

dir/b > mylist.txt, create list containing files names only.

dir/b > mylist.txt, create list with file size and dates.

dir/b/s > mylist.txt, create list including files in the sub-directories

4. File called mylist.txt is created on the shapefile folder

list file type


You can directly create xls file instead of txt file (dir/b > mylist.xls). This will create excel file (mylist.xls) then you can avoid step 5.

5. Now open the Microsoft Excel and import the mylisit.txt file, then click finish to create a list.

export my listText import Microsoft excel

6. You will have a excel sheets with a list of shapefiles and you can use it to clean the data.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close Menu