[Python-modules-commits] [python-coloredlogs] 04/07: Add mvduplicates.sh

Gaurav Juvekar gauravjuvekar-guest at moszumanska.debian.org
Sun Mar 12 20:19:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

gauravjuvekar-guest pushed a commit to branch master
in repository python-coloredlogs.

commit be9005ac5d7ff6f28bcf715e0dec5ed770cccd51
Author: Gaurav Juvekar <gauravjuvekar at gmail.com>
Date:   Wed Jan 18 17:20:03 2017 +0530

    Add mvduplicates.sh
---
 shell_programming/mvduplicates.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/shell_programming/mvduplicates.sh b/shell_programming/mvduplicates.sh
new file mode 100755
index 0000000..04dcf0c
--- /dev/null
+++ b/shell_programming/mvduplicates.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -x
+set -e
+
+src_dir="$1"
+dup_dir="$2"
+
+for file in `fdupes --omitfirst "$src_dir" | sed -e '/^$/d'`
+do
+	src_path=`realpath --canonicalize-existing --relative-to="$src_dir" "$file"`
+	target_path="$dup_dir/$src_path"
+	mkdir -p `dirname "$target_path"`
+	mv "$file" "$target_path"
+done

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-coloredlogs.git



More information about the Python-modules-commits mailing list