Delete files ending with - Copy in Windows 10

Solved
LokiMonster Posted messages 33 Status Membre -  
LokiMonster Posted messages 33 Status Membre -
Hello,

I’m having a lot of trouble with OneDrive right now, and one of the problems is that all my files have been duplicated...
I now have hundreds of files in the form of "name - Copy.*"
I can't delete them by right-clicking -> delete, nor by pressing "delete" or "shift + delete"
I tried to delete them via OneDrive online. I deleted all the copy files, but the synchronization wouldn’t happen... I was stuck with "175 processing" or something like that.
I reinstalled OneDrive, and it copied all the Copy files back to the drive...

The only way I found to delete them is via the Windows CMD, but it might take a very long time to do each file one by one....
I’m looking for a command or a small script to run to delete them all at once!

Hoping you can help me,

thanks

3 réponses

LokiMonster Posted messages 33 Status Membre 16
 
Ah well, I found it!

So if someone has the same issue, here's what to do:
Open the command prompt as an administrator (right-click, run as admin)
Then, in my case:
cd C:\Users\MYNAME\OneDrive\Documents\
del "*- Copy.*" /S

This deletes all files ending with "- Copy" regardless of their extension. And this applies to the documents folder as well as all subfolders (thanks to /S).
14
glg29 Posted messages 29751 Registration date   Status Contributeur Last intervention   4 582
 
Hello,
These files must have an extension, is it the same for all?
If so, maybe it's possible to select them in order to eliminate them!
For example, assuming that these extensions are .dwg, you just need to run a search by typing *.dwg, the files with that name will be grouped, and you can select all of them to delete.
Best regards.
--
He who does not bring joy upon arrival will always bring joy upon leaving!
Breizh a tao
2
LokiMonster Posted messages 33 Status Membre 16
 
No, they don't all have the same extension unfortunately... there are .docx, .pdf, and others.

How and where do I do this search?

Thank you.
0
glg29 Posted messages 29751 Registration date   Status Contributeur Last intervention   4 582 > LokiMonster Posted messages 33 Status Membre
 
You find yourself with hundreds of files.........
These should be placed in a specific location on the PC, right?
If they are in Documents, for example, you go to that location and then apply what is explained in the first response.


Just select everything and delete, the *.dwg in Documents are all there.
Do the same with docx, pdf, and others.
If you have duplicates of these files, you can also delete them with suitable software.
Best regards.
0
LokiMonster Posted messages 33 Status Membre 16
 
Yes, they are in my documents and then in a lot of subfolders, etc...
But okay, I see how you did it!

I searched a bit more on my side and I found this:
when I was using the command:
del "C:\Users\MYNAME\OneDrive\Documents\* - Copy.*"
it didn't work.

But by doing:
cd C:\Users\MYNAME\OneDrive\Documents\
del *- Copy.*

It worked!

Do you have any idea how to delete these - Copies in the subfolders as well? To save me from going into each folder to run the command
0
glg29 Posted messages 29751 Registration date   Status Contributeur Last intervention   4 582 > LokiMonster Posted messages 33 Status Membre
 
If you delete the master folder, are the subfolders still there?
@+
0
LokiMonster Posted messages 33 Status Membre 16
 
The problem is that all the files were created as duplicates and therefore as - Copy
But not the folders... They must have merged, I guess

But problem solved, thanks anyway!
0
glg29 Posted messages 29751 Registration date   Status Contributeur Last intervention   4 582
 
Indeed, it also works in the command prompt; it might even be simpler!
I didn't think to suggest it, not good.....
All that's left for you to do is to proceed and delete the files that need to be deleted.
@+

--
The one who doesn't bring joy upon arriving always brings joy upon leaving!
Breizh a tao
0
LokiMonster Posted messages 33 Status Membre 16
 
Much simpler, yes!
You just need to know, but it's sorted in 2 lines! 750 files deleted!

See you later ;)
0