cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way I can delete a folder and all files and subfolders from a windows server?

wpenfold
New Contributor III

When an employee leaves, their personal folder and any subfolders and files they have created needs to be deleted. I know I can delete an empty directory, but how can i find/delete all the files and subfolders they've created?

4 REPLIES 4

dmiller
Admin Admin
Admin

I'm looking to see if I have a pipeline for this...(think I may have broken it up into several small ones by asset type.)

Short term path, in classic Manager, you can use Asset Search to see where they are working to get a list of projects to work with, you can have a pipeline to find and delete assets by project (searching for their ID using everything before the @ seems to work best for me).

Some things to keep in mind when if you want to build your own pipeline:

  • This would best be used on non-admins users that have left since admins often create shared assets and own those assets by default. You don't want to accidentally delete someone else's project.
  • You would need to delete their assets before you remove them. Once they are deleted, any outstanding assets are reassigned to the admin that removed them.
  • The SnapLogic List Snap is your friend. To find files, use SnapLogic List set to All Assets (with a path to their project to lessen the load), followed by a Filter set to "$asset_type=='File' "

Diane Miller
Community Manager

wpenfold
New Contributor III

It's not snaplogic related files.  This is part of an identity management system.  When an employee leaves, all their personal files and folders need to be deleted off a windows server.  This was done before with Powershell scripts, but now converting to Snaplogic pipelines.

 

svatada
Former Employee

 

The FileDelete snap can indeed be utilised to delete files or empty directories.

FYI - If the file is a symbolic link, only the symbolic link itself, not the final target of the link, will be deleted. Moreover, if the file is a directory, the FileDelete snap will delete it only when the directory is empty.

On some operating systems it may not be possible to remove a file/directory when it is open and in use by this Java virtual machine or other programs. 

svatada_0-1713503855174.png

 

bojanvelevski
Valued Contributor

Hi @wpenfold,

You can develop a solution that lists all folders and files under a certain directory. At the end, simply use the File Delete snap.

Regards, 

Bojan