Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 772525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:48:58+00:00 2026-05-14T18:48:58+00:00

I have a drive on my computer that has folder–some of which have lots

  • 0

I have a drive on my computer that has folder–some of which have lots of folders w/in other folders and also contain files.
I need to migrate these docs into sharepoint, however a LOT of these folders and files have invalid characters that will not allow me to migrate into sharepoint (i.e. ” / \ &, etc.)

Is there any way to write something in C# that basically removes these invalid characters from all folders and files?

Please help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T18:48:58+00:00Added an answer on May 14, 2026 at 6:48 pm

    Yes. A way to do this would be to drill through the directory structure recursively, and for each file name, check if it is valid, and if it is not valid, make a valid filename, and upload to Sharepoint.

    You can make a Regex that matches all disallowed characters, and replace them with an allowed character, such as underscore. If you need names to be unique, and you are worried you might create duplicate names with this approach, store all names that has been used (ie. uploaded to Sharepoint) in something like a HashSet, and check that before using the generated name. If the name already exists, you can add a pre- or suffix, flag for human intervention, or do something else, depending on your requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a folder on my hard drive, C:\Program Files\Microsoft SDKs, and I was
I have a dvd copied in my hard drive. It has a folder called
I have an application that writes to a folder on the C:\ drive. The
I have an SSIS package that transfers some tables to CSV files on a
I am a senior computer engineering student and have an organization that has asked
I have a dilemma. My friend has lots of photos in random folders in
I have mapped a network drive to a computer in my home network. Now
I have some photos in specific drive on a hard disk, these photos all
I have the the following problem that starts to drive me nuts. I have
So I have two files: File 1 has this method in it: import MyGlobals

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.