Illegal characters

From Freephile Wiki
Revision as of 23:11, 1 December 2015 by Freephile (talk | contribs) (a beautiful one-liner)

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

You're cleaning up a Linux filesystem to make it compatible with Windows (which doesn't accept the kind of characters that Linux hangs around with).

find . -name "*[<>:\\|?*]*" -exec bash -c 'x="{}"; y=$(sed "s/[<>:\\|?*]\+/-/g" <<< "$x") && mv "$x" "$y" ' \;