Illegal characters: Difference between revisions

From Freephile Wiki
m added Category:Bash using HotCat
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight"
 
Line 1: Line 1:
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).
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).


<source lang="bash">
<syntaxhighlight lang="bash">


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


</source>
</syntaxhighlight>


[[Category:Bash]]
[[Category:Bash]]

Latest revision as of 13:28, 24 February 2025

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" ' \;