finding leading spaces in file names

General discussion related to "Everything".
Post Reply
rgrichar
Posts: 1
Joined: Tue Jul 19, 2022 11:22 pm

finding leading spaces in file names

Post by rgrichar »

Seems Windows doesn't worry about this much and will try to correct any manual input of leading spaces in file names, but seems I've used a sync/copy app that has left many hundreds of files with leading spaces in file names (spread thru a large folder structure).

Will Everything facilitate identifying all the offending files with leading spaces (regardless of remainder of file name)?

Any suggestions for a rename app to strip off these offenders once found. I'm thinking it's going to be a PowerShell script, but want to use something else to identify the scope of the problem (and confirm eventual fix)
froggie
Posts: 300
Joined: Wed Jun 12, 2013 10:43 pm

Re: finding leading spaces in file names

Post by froggie »

With everything 1.5

Code: Select all

regex:^\s+.*
will find files with leading spaces.

Advanced Rename will let you fix them. No other software needed.
raccoon
Posts: 1017
Joined: Thu Oct 18, 2018 1:24 am

Re: finding leading spaces in file names

Post by raccoon »

Also try in 1.5:

nopath:^:" "

or

"\ "
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: finding leading spaces in file names

Post by NotNull »

froggie wrote: Wed Jul 20, 2022 2:07 am Advanced Rename will let you fix them.
In case you (= rgrichar) need some details:
  • After typing in your search (see above), select all files ('CTRL + A')
  • Press 'F2' (or: Menu:File > Rename)
  • In the Rename dialog, enable Regular expressions
  • Old Format:
    ^\s*
  • New Format:
    (leave empty)
  • Check the new filenames
  • If all OK, press the OK button
  • Done


And yet another option to search for names that start with a space (as if 3 options aren't enough ... :D )

Code: Select all

startwith:" "
(BTW: make sure Match Path and Regular Expressions are disabled under the Search menu)
Post Reply