I am searching for the possibility with NetApp API and/or Powershell to do a quick scan on CIFS and NFS volume. My objective is to working with result offline?
The aim is to retrieve the list of files, created time, modified ... size And then parse the results for statistical or identify the file to copy ...
In a Windows NTFS FS (NTFS Master File Table) or Linux EXTx (inode), it is possible to access and scan this table of pointers in order to quickly browse and recover these items without having to really scan the FS. This is very useful for a FS with millions of files.
Sure It's possible to write a script to recursively enumerate a file system and log the results (assuming you run the script as a user who has administrative access throughout the entire file system) if such a user exists? Often NTFS permission inheritance is removed and users can remove administrative access in the event where they have been granted full control permissions, so the process you are suggesting it is prone to error and your script would need to implement a high degree of error checking to account for access denied errors. Depending on the number of files in your file system it could take a long time to run. I don't think there is any method available within WAFL to directly\quickly enumerate this information. You will need to peform a file system scan.
However, if your objective is to peform a migration of files to a destionation based on file age or date last access\modified then have you considered using robocopy with the following paramaters?
/CREATE :: CREATE directory tree and zero-length files only.
/MAXAGE:n :: MAXimum file AGE - exclude files older than n days/date. /MINAGE:n :: MINimum file AGE - exclude files newer than n days/date. /MAXLAD:n :: MAXimum Last Access Date - exclude files unused since n. /MINLAD:n :: MINimum Last Access Date - exclude files used since n.
If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
It still requires access from a client (vs API calls to the filer etc...) but you can also look at NetApp's XCP copy tool - https://xcp.netapp.com. It has some options to scan a file system and report on the metadata.
These could be combined to list all directories and files recursively...However keep in mind you would be potentially invoking a lot of ZAPI calls depending on the size of the file system. I'm not sure if this would be any quicker than scaning the file system. Either way it might have a performance impact on the system so you'd want to ensure you monitor that whilst running the script. It would be interesting to guage the performance of the directory and file listing by using measure-object on the ZAPI method compared to other methods mentioned here: