Skip to main content
added 167 characters in body
Source Link
Braden
  • 147
  • 2
  • 13

I have a library with greater than 10,000 files and I need a way to bulk delete files whose name includes text like "bad_file" or a certain value in another column. This is SP2013 on-prem so I do have access to DBs and PowerShell.

I know with PowerShell I can run a loop and access the file.Name attribute and do something such as

file.Name -like "bad_file*"

We also have a metadata column called "document type". Is it possible to delete all files with a certain value in that column?

My concern using PowerShell is the size of this library and checks and balances. I don't want to run this through thousands of files and find out it did something unexpected. Is there a way to first export the list of files for review and then change the code to delete after reviewing?

Does anyone have experience doing something like this using PowerShell, or even going the database route? Could you provide an example of how you accomplished this?

Thanks!

I have a library with greater than 10,000 files and I need a way to bulk delete files whose name includes text like "bad_file". This is SP2013 on-prem so I do have access to DBs and PowerShell.

I know with PowerShell I can run a loop and access the file.Name attribute and do something such as

file.Name -like "bad_file*"

My concern using PowerShell is the size of this library and checks and balances. I don't want to run this through thousands of files and find out it did something unexpected. Is there a way to first export the list of files for review and then change the code to delete after reviewing?

Does anyone have experience doing something like this using PowerShell, or even going the database route? Could you provide an example of how you accomplished this?

Thanks!

I have a library with greater than 10,000 files and I need a way to bulk delete files whose name includes text like "bad_file" or a certain value in another column. This is SP2013 on-prem so I do have access to DBs and PowerShell.

I know with PowerShell I can run a loop and access the file.Name attribute and do something such as

file.Name -like "bad_file*"

We also have a metadata column called "document type". Is it possible to delete all files with a certain value in that column?

My concern using PowerShell is the size of this library and checks and balances. I don't want to run this through thousands of files and find out it did something unexpected. Is there a way to first export the list of files for review and then change the code to delete after reviewing?

Does anyone have experience doing something like this using PowerShell, or even going the database route? Could you provide an example of how you accomplished this?

Thanks!

Source Link
Braden
  • 147
  • 2
  • 13

Bulk delete files from library using name of file

I have a library with greater than 10,000 files and I need a way to bulk delete files whose name includes text like "bad_file". This is SP2013 on-prem so I do have access to DBs and PowerShell.

I know with PowerShell I can run a loop and access the file.Name attribute and do something such as

file.Name -like "bad_file*"

My concern using PowerShell is the size of this library and checks and balances. I don't want to run this through thousands of files and find out it did something unexpected. Is there a way to first export the list of files for review and then change the code to delete after reviewing?

Does anyone have experience doing something like this using PowerShell, or even going the database route? Could you provide an example of how you accomplished this?

Thanks!