ONTAP Discussions

Efficient method for deleting a large amount of data




We're running OnTap 8.2.1. I was looking for a system side command I could use to browse cifs shares and remove a particular folder under a root share as opposed to navigating the share from Windows, but I haven't seen anything. I'm curious if anyone here has a tip/trick for removing overly complex, deep/large folder structures without just removing the entire share?


So far it's taking 20+ minutes to discover the folders content from a windows client before the system starts to delete anything.


The structure looks similar to the following:


Groups (top level folder/share)

-Group1 (1TB, 250k+ files)

-Group2 (2TB 1M+files)

-Group3 ( 1.8TB 500k+ files)


The "group 2" folder would be the one I'd like to remove.


Appreciate any assistance you could provide.







Hi Brian,


I do *lots* of CIFS / NAS Folder and File re-structuring, and for *years* have been wanting a controller-side feature for deleting QTREE + data or deleting volume subfolder(s) + data.


There is a 'QTREE delete' command available (I think only a GUI feature) but it only deletes *empty* QTREEs - you have to have previously used a Windows/Linux host to delete the actual data.


From your question notes, it looks like you are trying to use Windows Explorer/GUI to delete large folders (+subfolders and files). The drawback of which is that Win Explorer has to enumerate the data before starting the actual delete process.


Instead, you can use the 'RMDIR' command from the Windows Command line. It skips the enumeration process and starts deleting files and folders immediately.


eg to delete a 2TB size second-level folder (and all subfolders and data) under a top level network share called 'Projects' :


c:>RMDIR /S /Q \\server\Projects\second-level


/S = (run recursively on all subfolders, files) /Q = (quiet mode, disable confirmations)


Thats it - the command will traverse the subtree and delete the data.


Powershell has a command to delete *whole* qtrees from C-mode controllers




It wil need the -FOrce to delete a qtree that is not empty


Remove-NcQtree -VserverContext myvserver -Volume myvol -Qtree myqtree -Force 


To remove subdirectories, you have to delete all files therein first... 

Read-NcDirectory, then interate into any sub directories and remove-ncfile/remove-ncdirectory


Just having problems at the moment working out what permissions I need to give a user/role to delete files!






Refer KB 2017624 BUG 599967:CIFS or NFS operations are delayed due to concurrent deletions of many large files

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.