#!/bin/bash

# Copyright 2013-2016 kinugarage.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# DESCRIPTION: This script removes all the "conflicted copy" files on your computer that are generated by Dropbox.
#              Should work on all bash (or sh) environment, but as of May 2016, it is confirmed to run on Ubuntu (12.04 - 15.04), OSX
#
# DESCLAIMER: Although this software has been working for original author's purpose for years, nobody guarantees that it is free from defects. The software is provided as is," and you use the software at your own risk.
#
# Author (original): Isaac I. Y. Saito

TOPFOLDER_DROPBOX=$(TOPFOLDER_DROPBOX:=~/data/Dropbox)
SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
counter=0
for f in `find ~/data/Dropbox -iname '*conflicted copy*'`;
#for f in `ls`;
do
  echo '#'$counter 'th file being removed: ' $f
#  rm '"'$f'"'
  rm $f
  echo '   Trying to access the same file: ' $f
  ls -alth $f
  ((counter++))
done
echo $counter "conflicted copy files were just removed."
IFS=$SAVEIFS

Add Dropbox conflict clearance tool.
Add Dropbox conflict clearance tool.
