How to find any file or folder with a trailing space in it’s name, and delete the trailing space

does not know handle files or folders whos name ends in a space. Usually won’t allow you to delete these files, and other bizarre behavior.

This is a simple command to fix that.

 

find . -name '* ' -exec sh -c 'x="{}"; mv "$x" "${x%?}"' \;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.