summaryrefslogtreecommitdiff
path: root/doc/tips
diff options
context:
space:
mode:
authorGravatar Mesar Hameed <mhameed@src.gnome.org>2012-09-05 09:56:45 +0100
committerGravatar Mesar Hameed <mhameed@src.gnome.org>2012-09-05 09:56:45 +0100
commitb7bb3fc413ff9de4b7f4b996a10ecb63cee85dac (patch)
treea9fc2c918300845d49cb1f3f139ad8149bc3bfeb /doc/tips
parentb66f9323e0bf9331add2e6428f5b443d4a463d50 (diff)
Added a comment: problems with spaces in filenames
Diffstat (limited to 'doc/tips')
-rw-r--r--doc/tips/finding_duplicate_files/comment_3._comment39
1 files changed, 39 insertions, 0 deletions
diff --git a/doc/tips/finding_duplicate_files/comment_3._comment b/doc/tips/finding_duplicate_files/comment_3._comment
new file mode 100644
index 000000000..44eeb5075
--- /dev/null
+++ b/doc/tips/finding_duplicate_files/comment_3._comment
@@ -0,0 +1,39 @@
+[[!comment format=mdwn
+ username="mhameed"
+ ip="82.32.202.53"
+ subject="problems with spaces in filenames"
+ date="Wed Sep 5 09:38:56 BST 2012"
+ content="""
+
+Spaces, and other special chars can make filename handeling ugly.
+If you don't have a restriction on keeping the exact filenames, then
+it might be easiest just to get rid of the problematic chars.
+
+ #!/bin/bash
+
+ function process() {
+ dir="$1"
+ echo "processing $dir"
+ pushd $dir >/dev/null 2>&1
+
+ for fileOrDir in *; do
+ nfileOrDir=`echo "$fileOrDir" | sed -e 's/\[//g' -e 's/\]//g' -e 's/ /_/g' -e "s/'//g" `
+ if [ "$fileOrDir" != "$nfileOrDir" ]; then
+ echo renaming $fileOrDir to $nfileOrDir
+ git mv "$fileOrDir" "$nfileOrDir"
+ else
+ echo "skipping $fileOrDir, no need to rename."
+ fi
+ done
+
+ find ./ -mindepth 1 -maxdepth 1 -type d | while read d; do
+ process "$d"
+ done
+ popd >/dev/null 2>&1
+ }
+
+ process .
+
+Maybe you can run something like this before checking for duplicates.
+
+"""]]