Need to Rename 2000 Files ( Remove the first two spaces )

Sorry if this belongs elsewhere !!! Perhaps the Admin can move if necessary

I have 2000 files that begins with two spaces then the File Name… I wish to remove the two spaces.

I have “A Better Finder Rename 11”, “Automator” and “Hazel” but cannot figure out how to do this…

Please advise

Please advise

A Better Finder Rename supports regular expressions, which would Give a robust solution but I don’t see any documentation beyond sales info on their web site. I suspect the powerful options are in the advanced side bar, but it is not a product I use.

But let’s assume that the only place you have two spaces is at the start of the file names. If so, you should be able to replace it just using Finder’s rename.

There’s a description of how in this TidBits article.

If you have double spaces in multiple places in the filenames, then a different approach is required. It can be done via the terminal, but the advanced options in A Better Finder Rename would probably be easier for you to use.

Hope that helps.

You can remove the first two characters of a file name in “A Better Finder Rename 11” by setting it up as shown in the attached screenshot.

Brilliant !!! Many thanks

@rphillipchuk, looks like you’ve received the information sufficient to solve your problem. But related to this topic, I thought I’d add the following…

The Finder does include more rename power than is obvious: Step By Step: Using The Mac Batch Rename Tool

Unless I’m missing something, the Finder batch rename will work to remove file prefixes unless these prefixes are consistent AND do NOT appear elsewhere in the file names.

For those that don’t have A Better Finder Rename X but are willing to use Terminal, here are some options:

A wealth of info… A GREAT Group…

Or Cud use this applescript

Select the Files which needs renaming & run

set searchString to "--"
set replaceString to ""
tell application "Finder" to set SourceFiles to (get selection as alias list)


if SourceFiles is {} then display dialog "No files to Rename." -- Nothing to do


try
	tell application "Finder"
		repeat with aFile in SourceFiles
			set aFilePath to POSIX path of (aFile as text) -- Include path/to/ filename.ext
			set aFileName to name of aFile -- this is filename.ext
			set aFileExt to name extension of aFile --.ext
			set aFileNameSanExt to my remove_extension(aFileName) -- filename, no ext
			set NewFileSanExt to my replace_text(aFileNameSanExt, searchString, replaceString)
			set newName to NewFileSanExt & "." & aFileExt
			set name of aFile to newName
		end repeat
	end tell
end try


on replace_text(this_text, search_string, replacement_string)
	set prevTIDs to AppleScript's text item delimiters
	set AppleScript's text item delimiters to the search_string
	set the item_list to every text item of this_text
	set AppleScript's text item delimiters to the replacement_string
	set this_text to the item_list as string
	set AppleScript's text item delimiters to prevTIDs
	return this_text
end replace_text


on remove_extension(this_name)
	if this_name contains "." then
		set this_name to ¬
			(the reverse of every character of this_name) as string
		set x to the offset of "." in this_name
		set this_name to (text (x + 1) thru -1 of this_name)
		set this_name to (the reverse of every character of this_name) as string
	end if
	return this_name
end remove_extension

Info272

Many thanks… This will be kept…