Need to Search and Replace "&" with And in all files in my system

Discussion related to "Everything" 1.5 Alpha.
Post Reply
BrettUSA269
Posts: 20
Joined: Thu Jan 07, 2021 3:47 pm

Need to Search and Replace "&" with And in all files in my system

Post by BrettUSA269 »

I have found the special char "&" creates an issue when trying to zip a file in microsoft window 10. So if you have a file within a folder with "&" it won't work.

IMPORTANT: I don't want to screw anything up. I only want to find "&" in file names and folders and replace it with "and" and leave everthing else the same. ex Bill & Jane.txt with Bill and Jane.txt

So what special commands do I need to know??

Reason why I think I might have to do a find and replace?
I usually don't use zip files but having issues with my onedrive no syncing with with onedrive in the cloud?? I don't know but guessing or it may because i have been doing some massive changes with folders that I'm syncing on onedrive from local computer to onedrive in cloud when it's says it's looking for changes but things are not getting done quickly.

I have paused syncing then turned it back on. Still says it is looking for changes and yet a number of folders are not getting synced?
horst.epp
Posts: 1443
Joined: Fri Apr 04, 2014 3:24 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by horst.epp »

I don't know what file manager you are using.
In Total commander I let Everything search for the names containing &
and then using TCs multi-rename function with search and replace.
The same can be done in XYplorer based on an Everything search.
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by void »

Make sure you exclude any system folders, for example:

!c:\users\*\appdata\** !C:\windows\ !"c:\program files\" !"c:\program files (x86)\" !"c:\programdata\"



Consider using the document filter to limit the renamed files to documents only:

doc:



Search for non-system doc files containing &:

!c:\users\*\appdata\** !C:\windows\ !"c:\program files\" !"c:\program files (x86)\" !"c:\programdata\" doc: &



To rename & to and for all these files with Everything:
Select all the results. (Ctrl + A) (consider only doing a few 100-1000 files at a time)
Press F2.
Make sure regular expressions is checked.
Change the old format to: &
Change the new format to: and
Double check the newly generated filenames are as desired.
Click OK.



Make a backup of your filenames before doing anything from File -> Export.



Undo multiple file renames from Edit -> Undo or Index -> Index Journal (Everything 1.5+) for more control.
Stamimail
Posts: 1122
Joined: Sat Aug 31, 2013 9:05 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by Stamimail »

void wrote: Fri Jul 15, 2022 10:05 amMake a backup of your filenames before doing anything from File -> Export.
I'm not sure how it will help. How to restore?
In severe cases, the user had to export checksum or/and other properties, in order to restore the file structure. (and also then I would ask: how to restore?)
Undo multiple file renames from Index -> Index Journal (Everything 1.5+)
This is not an intuitive way for those unfamiliar with the Index Journal.
Where the user will look to solve the problem?
You can add a button for "Index Journal" in Rename dialog.
You can add "Index Journal" entry somewhere in Undo menu.
therube
Posts: 4955
Joined: Thu Sep 03, 2009 6:48 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by therube »

I'm not sure how it will help. How to restore?
Don't know that it's intended for "restore", but rather reference of what was done in case something goes awry.
This is not an intuitive way for those unfamiliar with the Index Journal.
Index Journal is not an intuitive feature & one that most will never frequent (so in that regard... IMO...).


Aside from Index Journal, there is Ctrl+Z (undo, & Ctrl+Y, redo).
void
Developer
Posts: 16672
Joined: Fri Oct 16, 2009 11:31 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by void »

Yes, the filename backup is just so you have a reference of the original filenames.


Yes, Edit -> Undo will work for multiple file renames.
The Index Journal will give you more control (Undo a single rename).
NotNull
Posts: 5458
Joined: Wed May 24, 2017 9:22 pm

Re: Need to Search and Replace "&" with And in all files in my system

Post by NotNull »

void wrote: Fri Jul 15, 2022 10:05 am Make sure regular expressions is checked.
Change the old format to: &
Change the new format to: and
I did this some time ago and found that there were cases where there were no spaces around the &, like some song part one&two

This worked for me (regular expressions enabled)
OLD:\s*&\s*
NEW:
_&_

(replace the _ with a SPACE)
Post Reply