How to automatically delete duplicate files in OneDrive (SharePoint?) after re-adding the computer

Loading___ 1 Reputation point
2021-01-31T14:09:07.747+00:00

Hi all,

We are using OneDrive For Business to sync files between multiple user computers. I am not talking about one user having multiple PC's and using OneDrive to sync their personal files across all their devices. I am talking about a shared folder and multiple users having this location added to OneDrive on their PC's. Basically it's almost like having a SharePoint site and everybody having this added to OneDrive on their PC's. But since our O365 licences doesn't include SharePoint - we have created a shared OneDrive folder under one account then shared it with other users and they all added this to their OneDrive on their PC's.

At some point one of the PC's didn't need this anymore so I went into OneDrive settings, stopped the sync / unlinked the PC. But I left the local copy of the data on the C drive.

After a while we needed this PC to be able to sync again so I've just followed the same steps for adding the shared folder to the PC as I did the very first time: went into the shared folder on the web browser and clicked "Sync" at the top menu of the OneDrive page, got the OneDrive app to pop up prompting for user login, followed the steps, etc.

When it told me that the folder/location with the same name already exists on the local C drive I clicked "Yes" to use the same instead of creating a new one. I was hoping that OneDrive will be able to detect which files have or have not been edited by other users during the period whilst this PC was unlinked and will only update the local copy ("sync down" the changes) from the cloud.

However it seems to have downloaded everything again, but then it also uploaded all local files back into the cloud with appended file names. The new file names are "Original_file_name-computername". And of course all these duplicate files have been synced to all other users too.

I've done a bit of research on this but all I found is some suggestions on refreshing user credentials on Windows Credential Manager:
https://support.microsoft.com/en-us/office/duplicate-files-in-onedrive-fd47ce5e-8dd0-465e-9e3a-461e1a3cf613
https://answers.microsoft.com/en-us/msoffice/forum/msoffice_drive-mso_win10-mso_365hp/onedrive-sync-issues-affecting-office-documents/638c2734-bd2f-4c7e-b245-e28a46ccee43?auth=1
But if I understand correctly this would only prevent any further file duplications.

However what I really need is a solution on how to easily and effectively remove all duplicated files without deleting anything that is current.

I hope that no actual files have been overwritten in the cloud as anything of same name from this PC was simply uploaded with the appended name instead. Therefore I hope that what we have now is all the good files synced across all PC's and all old files from this one PC synced to other PC's too but with an appended name. Can someone confirm that this is indeed the way OneDrive works in such situations?

I am thinking about running a search against the OneDrive folder for "computername" in the file names and just deleting them all, but was wondering if there was a bit more automated or less laborious way?

Thanks

OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,149 questions
0 comments No comments
{count} votes

5 answers

Sort by: Most helpful
  1. Emily Hua-MSFT 27,551 Reputation points
    2021-02-01T10:03:49.05+00:00

    @Loading___

    > Can someone confirm that this is indeed the way OneDrive works in such situations?

    If there is a syncing conflict, to prevent data loss, generally, OneDrive would save both copies, and appending the computer name for to the duplicate files. Besides, the old and new files could be synced to other PC.

    > I am thinking about running a search against the OneDrive folder for "computername" in the file names and just deleting them all, but was wondering if there was a bit more automated or less laborious way?

    I am afraid, you need to do it manually currently.
    If you want to confirm if there are any programmatic operations to help you improve efficiency, I suggest you try to post a new thread on the following forum, as it may needs code development.
    OneDrive Developer

    Thanks for your understanding.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Chris Wilkerson 1 Reputation point
    2021-11-07T02:47:47.42+00:00

    I share your pain. What a mess! I have hundreds of files that are the same. Does MS do this so we max out and have to pay for more room?


  3. Tyler Graham 1 Reputation point
    2022-02-10T15:59:53.983+00:00

    Do you have a power automate license? You could accomplish the searching of files in OD4B with "computername" in the file name and automatically delete them with power automate.

    0 comments No comments

  4. Chris Wilkerson 1 Reputation point
    2022-02-10T16:14:46.907+00:00

    No license.

    I bought Cisderm a program that finds duplicates. I have to download Onedrive onto my hd, check for duplicates then upload again.
    Not a perfect solution.

    0 comments No comments

  5. Paolo Pugliese 1 Reputation point
    2022-06-17T12:28:54.483+00:00

    Hi.
    I've never tested it with OneDrive Business (and I would be actually interested to know if it works or not) but I recently published a free mobile app (link) that finds and removes duplicate files from OneDrive (and others).
    The major advantage is that it doesn't need to download anything! It calls the API of OneDrive and checks and compares the hash of the files.

    Otherwise, I recently discovered a command line tool called Rclone that could suit your needs, if combined with some other programming or automation tool.

    Hope to be useful.