Remove Spaces from File Names

Discuss and share scripts and script files...
Post Reply
visualplastik
Posts: 2
Joined: 16 Nov 2009 03:30

Remove Spaces from File Names

Post by visualplastik »

Have about 170 files to remove spaces from. Possible with scripts?

Also haven't tried any scripts yet, do you just paste in the try script panel?

Thanks

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Remove Spaces from File Names

Post by serendipity »

visualplastik wrote:Have about 170 files to remove spaces from. Possible with scripts?

Also haven't tried any scripts yet, do you just paste in the try script panel?

Thanks
Hi and Welcome!
Try the below command from address bar or try script panel:

Code: Select all

::rename s, " >";
Also, if you are interested in scripts read more about it:
http://www.xyplorer.com/tour/index.php?page=scripting
http://88.191.26.34/XYwiki/index.php/Scripting

visualplastik
Posts: 2
Joined: 16 Nov 2009 03:30

Re: Remove Spaces from File Names

Post by visualplastik »

Ah man thats like magic, thx!

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Remove Spaces from File Names

Post by serendipity »

visualplastik wrote:Ah man thats like magic, thx!
Yup, scripting can make life so much easier.

Just so that you know what that script means, here is the explanation:

Code: Select all

::rename s, " >";
:: = Its for XY to recognize that a script is starting
rename = XY command for renaming
s = abbr for for "search and replace"
" >" = Replace all instances of space [ ] with nothing []
another example:
"A>B" = replace all As with Bs

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Remove Spaces from File Names

Post by admin »

serendipity wrote:
visualplastik wrote:Ah man thats like magic, thx!
Yup, scripting can make life so much easier.

Just so that you know what that script means, here is the explanation:

Code: Select all

::rename s, " >";
:: = Its for XY to recognize that a script is starting
rename = XY command for renaming
s = abbr for for "search and replace"
" >" = Replace all instances of space [ ] with nothing []
another example:
"A>B" = replace all As with Bs
I would have suggested this script:

Code: Select all

rename s, " ", p;
The "a>b" syntax works as well, but rather as a special case. In general form it means: replace all single characters listed left of ">" with the string right of ">".

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: Remove Spaces from File Names

Post by serendipity »

admin wrote:
serendipity wrote:
visualplastik wrote:Ah man thats like magic, thx!
Yup, scripting can make life so much easier.

Just so that you know what that script means, here is the explanation:

Code: Select all

::rename s, " >";
:: = Its for XY to recognize that a script is starting
rename = XY command for renaming
s = abbr for for "search and replace"
" >" = Replace all instances of space [ ] with nothing []
another example:
"A>B" = replace all As with Bs
I would have suggested this script:

Code: Select all

rename s, " ", p;
The "a>b" syntax works as well, but rather as a special case. In general form it means: replace all single characters listed left of ">" with the string right of ">".
Yup my bad, "rename s, " ", p;" is much simpler.

admin
Site Admin
Posts: 66083
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Remove Spaces from File Names

Post by admin »

serendipity wrote:Yup my bad, "rename s, " ", p;" is much simpler.
But would not work from address bar because I forgot the "::". :roll:

Better:

Code: Select all

::rename s, " ", p;
For newbies: the 3rd argument "p" makes it show a preview before doing the rename.

Post Reply