Skip to content

Instantly share code, notes, and snippets.

@n3dst4
Created November 9, 2013 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n3dst4/7385269 to your computer and use it in GitHub Desktop.
Save n3dst4/7385269 to your computer and use it in GitHub Desktop.
This is a bash script for use in Windows (for use with Cygwin/Git Bash etc) to shrink foldernames on shitty windows. Since shitty windows's shitty FS allows you to create files with a path length greater than the maximum allowable path length (!) you can end up with an undeletable folder structure. This script recurses through and renames everyt…
#!/bin/bash
# set this to the problem folder
BASE=/c/Users/ndc/Dropbox/projects/delete-me
cd $BASE
for i in `find $BASE -depth`
do
DIR=`dirname $i`
FILE=`basename $i`
mv $i $DIR/${FILE:0:1};
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment