Skip to main content
NetApp Knowledge Base

Can ONTAP CLI list files in a CIFS share or volume?

Views:
1,364
Visibility:
Public
Votes:
0
Category:
ontap-9
Specialty:
nas
Last Updated:

Applies to

  • ONTAP 9
  • CIFS/SMB
  • Volumes

Answer

  • ONTAP CLI does not have a specific command to list CIFS share contents at this point, but the following can be used:

1. Identify share in question to get the path:

::> vserver cifs share show SQLBKUP$ -fields volume,path
vserver share-name path volume
---------- ---------- --------------------- ------------
svm SQLBKUP$ /cifs_data/SQLBKUP cifs_data

2. Use the path with a wildcard (*) in file-directory show:

::> vserver security file-directory show -vserver svm -path /cifs_data/SQLBKUP/* -fields path
vserver path
---------- ----------------------------
svm /cifs_data/SQLBKUP/SQL8
svm /cifs_data/SQLBKUP/SQL8/master
svm /cifs_data/SQLBKUP/SQL8/master/master_db_202412270000.BAK
svm "/cifs_data/SQLBKUP/SQL8/master/yesterday 202412280000.BAK"
...
svm /cifs_data/SQLBKUP/SQL8/model
svm /cifs_data/SQLBKUP/SQL8/model/model_db_202412270000.BAK
svm "/cifs_data/SQLBKUP/SQL8/model/some space 202412280000.BAK"

Note: filenames containing white spaces are displayed with surrounding quotation marks ""

  • For a volume the junction-path is the starting point:
  1.  Identify the junction path:

::> volume show nfs_data -fields junction-path
vserver volume junction-path
---------- --------- -------------
svm nfs_data /nfs_data

  1. Use the path with wildcard (*) in file-directory show:

::> vserver security file-directory show -vserver svm -path /nfs_data/* -fields path
vserver path
---------- --------------------
svm /nfs_data/AnyVM
svm /nfs_data/AnyVM/AnyVM-4d69cc64.hlog
svm /nfs_data/AnyVM/vmware-36.log
svm /nfs_data/AnyVM/vmware-35.log
svm /nfs_data/AnyVM/vmware-34.log
svm /nfs_data/AnyVM/vmware-33.log
svm /nfs_data/AnyVM/vmware-32.log
svm /nfs_data/AnyVM/vmware.log
svm /nfs_data/AnyVM/AnyVM-aux.xml
svm /nfs_data/AnyVM/AnyVM_1-flat.vmdk
svm /nfs_data/AnyVM/.lck-6c00e88e00000000
svm /nfs_data/AnyVM/AnyVM.vmx

 

Additional Information

  • System Manager 9.8 and later (ONTAP File System Analytics) allows volume content to be listed via Volumes > Volumename > File System > Explorer
  • If folder/directory content needs to be compared after a data migration, NetApp XCP maybe be preferrable.

 

NetApp provides no representations or warranties regarding the accuracy or reliability or serviceability of any information or recommendations provided in this publication or with respect to any results that may be obtained by the use of the information or observance of any recommendations provided herein. The information in this document is distributed AS IS and the use of this information or the implementation of any recommendations or techniques herein is a customer's responsibility and depends on the customer's ability to evaluate and integrate them into the customer's operational environment. This document and the information contained herein may be used solely in connection with the NetApp products discussed in this document.