Count files in a folder

A quick BASH command to count the number of files in a folder with a specific search term:

ls -d *searchterm* | wc -l

So for example, count all the shapefiles in a folder called spatialdata in your home folder:

~$ pwd
/home/al
ls -d spatialdata/*shp* | wc -l

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.

Up ↑

%d bloggers like this: