Script to find files that begin with a space

Kennedy
New Contributor II

Hi all,

Please forgive my bash scripting ignorance, but I was wondering if one of you scripting gods could help me with a small script or command to output a list of files that start with a space character.

Using the find command or something similar is where I'm heading.

Cheers,
Gav

2 REPLIES 2

Kennedy
New Contributor II

Wow, how simple:

find /Users/username -name " *"

I'm going to try and output the list of files to a text file and email it to our support team as an attachment. If I manage to get this working I'll post it up. If anyone has any tips of existing scripts like this in the meantime, that would be great.

Cheers,
Gav

sean
Valued Contributor

Try:

find /Users/username -name " *" -exec echo {} > /tmp/outfile.txt ;