All Files Titled Sync-Conflict

I was rapidly changing permissions on a folder that has tons of files. Now every file in the folder has conflicted. This is reflected on both of my clients. So I cannot simply restore from the opposite one. No originals exist. I am sorta in a panic as my backup is a few days old and I did a lot of work in that time and since this folder has git repositories in it manually renaming is not feasible. Does anyone know of some bash fu to remove the sync-conflict-(date) on all the files? Thanks so much.

Permission changes by themselves should not cause sync conflicts. When you do get sync conflicts, there should be one “real” copy of the file and one “conflict” file. If you think the conflicts were incorrect you can simply remove the conflict files.

From the top of my head, this should get rid of them, but do try it somewhere safe. No warrantee, may eat your files.

find . -name "*.sync-conflict-*" -print0 | xargs -0 rm

That would be fine if the files did exist. I usually use find . -name and -delete to remove the conflicts but honestly the originals no longer exist on either side. The permission changes involved included locking myself out of the files. So idk if that played a role.

Ah, so it may have been a conflict between delete and change or so. If this is linux, look into the rename command. It can rename things based on expressions.

Guess I better learn regex xD. I have been putting it off and I regret it every other day lol.

In the meantime if anyone happens to have a Bash solution for this specific case please let me know. I cannot get any work done this whole time lol. Plus side I now know to be more vigilant with my backups.

Search the forum, it has been answered before.

I have. All the solutions I have found involve DELETEING sync conflicts. I need to rename them.

Searching “sync conflict rename” brings a total of 19 results. None of which do what I need as far as I can tell. I do not like to be that guy who posts before searching. I have looked. And I definitely Googled it before posting on Github then having to make an account in the forums. Which was why I posted the issue. I already had a Github account.

You can probably reuse bits from here:

And just use find to find all the conflicts.

1 Like

Thank you. This guy’s pipe fu is ridiculous but I am sure I can adapt this.

shopt -s globstar
rename -n 's/\.sync-conflict-[0-9]*//' **

The -n is a no action flag for testing

The globstar option allows recursive folder traversal.

's/\.sync-conflict-[0-9]*//' means remove “sync-conflict-” I don’t know how the files are named so I can’t give you the exact steps at the moment. When I try pausing a sync and creating conflicts one of the files is destroyed… BUG! Will post it shortly.

Updated based on the <filename>.sync-conflict-<datetime>.<ext> naming structure found in the forum. If the files don’t look like clash.sync-conflict-20160603155959.txt this will be wrong. Post a filename so I know what it looks like.

FYI: Filed a bug report.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.