How to Filter removable, remote/virtual, and read-only files

Questions and Answers about all things *OS (macOS, iOS, tvOS, watchOS)

How to Filter removable, remote/virtual, and read-only files

Postby Dipti » Thu Jul 28, 2016 8:33 am

Hi,

I want to find some specific type of files on all mounted devices only by Filtering out removable, remote/virtual, and read-only filesystems from mounts. On Linux I am able to do it using below command:

MNT_FILE="/proc/mounts"
#
# Filter out removable, remote/virtual, and read-only filesystems from mounts.
#
MNT_PNT=$(([ "$RMV" == "" ] && cat $MNT_FILE || grep -v "$RMV" $MNT_FILE) | \
awk '$3 !~ /^smbfs|cifs|nfs|ncpfs|codafs|afs|autofs|vmware-hgfs|vmhgfs|ramfs|debugfs|tmpfs|rootfs|proc|sysfs|configfs|devfs|devpts|usbfs|binfmt|securityfs|selinuxfs/ \
&& $4 ~ /^rw/ { print $2 }')


RMV is nothing but list of USB devices which I could get on OSX using below command:
RMV=`system_profiler SPUSBDataType | grep "Mount Point" | awk 'NF>1{print $NF}'`

But I am not able to get the filesystem Type to filter out other mounted devices on OSX. Any suggestion please?

Thank you.
Dipti
 
Posts: 16
Joined: Wed Jul 20, 2016 10:32 am

Re: How to Filter removable, remote/virtual, and read-only f

Postby morpheus » Thu Aug 04, 2016 3:58 pm

To be honest, I don't really get the question. There are no virtual mounts in MacOS. The best you can get is OSXFuse - but otherwise all files are very very tangible. But other mounts (e.g. loop) still count as real ones.
morpheus
Site Admin
 
Posts: 532
Joined: Thu Apr 11, 2013 6:24 pm

Re: How to Filter removable, remote/virtual, and read-only f

Postby Dipti » Fri Aug 05, 2016 3:40 am

ok Thanks. Let me see to it further ...
Dipti
 
Posts: 16
Joined: Wed Jul 20, 2016 10:32 am


Return to Questions and Answers

Who is online

Users browsing this forum: No registered users and 2 guests

cron