Space at end of file name
-
Loufubu7
- Posts: 6
- Joined: 28 Dec 2021 00:37
Space at end of file name
Hello, so let me start off by apologizing in advance if there's a place that spells this out but there so much information that I just can't seem to find it. I have what amounts to thousands of file names with a space at the end just before the extension. The file names are all different lengths. If anyone knows how to target that space and get rid of it I would appreciate your help with that. I am going to have to rename a ridiculous number of files so they are searchable and I hate unnecessary numbers in file names and when I target those at the end of file name its leaving a space in that place every time. It would be great if I could still remove the numbers and then the extra space in a separate step. Otherwise, I have to group files to avoid the space being there in the first place but thats the long way around and I'd probably end up leaving the space instead. If it cannot be done, that's fine, it doesn't technically seem to be making a difference but I'm incredibly anal and figured if there was a way, someone that knows the program better would know here.
-
RalphM
- Posts: 2145
- Joined: 27 Jan 2005 23:38
- Location: Cairns, Australia
Re: Space at end of file name
If the spaces are the result of removing numbers then that rename should have been planned better (to get rid of the space along the way).
You might want to give some typical examples of your filenames before and after the rename you want to perform and someone here will certainly come up with a suitable way to make your rename happen.
You might want to give some typical examples of your filenames before and after the rename you want to perform and someone here will certainly come up with a suitable way to make your rename happen.
Ralph 
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
-
o7blue
- Posts: 143
- Joined: 22 Dec 2020 07:10
Re: Space at end of file name
It seems to me like a renaming utility like Bulk Rename Utility is more suited to your use case. This can probably be done with scripting but here's what I came up with (the trim checkbox removes the trailing space and the subfolders checkbox lets you rename files from multiple locations at once. In my example I only put a trailing space on one file, second from last in the list):
To see the attached files, you need to log into the forum.
OS: Windows 10
DPI: 100%
DPI: 100%
-
highend
- Posts: 15016
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Space at end of file name
Ofc this can be done with a simple script...
Code: Select all
$files = quicksearch(">.*?[ ]+\.[^.]+$ /f", , , "s");
if ($files) {
$renamed = regexreplace($files, "^(.*?)([ ]+)(\.[^.]+)$", "$1$3");
rename "l", $renamed, "p", $files, 64;
}
One of my scripts helped you out? Please donate via Paypal
-
Loufubu7
- Posts: 6
- Joined: 28 Dec 2021 00:37
Re: Space at end of file name
Hey guys, I did figure out a way to target those spaces but there are multiple steps for each file type. Right after I posted this question a lightbulb clicked on. Definitely doable and I am pleased that I found a way at least.
RalphM, I am a mother of 4 who homeschools and is trying to manage these files to use in personal editing. I found this program a few months ago and am slowly started to use it in my free time. So telling me I "should have planned better," is like telling me the sky is blue. While both things are technically true, they are not really useful in my current situation and offer no actual help. I mentioned the fact the files vary so you would understand giving you actual file names probably wouldn't be useful. You will be thrilled to learn that after I realized it was happening, I changed my method of renaming such files to get rid of that space.
However, my question was to address the files that still had the space because they still needed to be fixed. Truthfully, if there was a way to get rid of that space rather than doing it the way I am, it would actually save a ton of time. Which is why I asked to see if someone here knew how to do this.
o7blue I didn't know there was an option out there like that. I will look into that option today as it looks like something I could use. I appreciate your suggestion.
highend I have no idea what that says/means but I will give it a try. Looks like I'm delving into the world of scripts today.
There are probably several ways to go about this so anyone has any other suggestions please feel free to keep adding to this. Thank You to everyone who took the time to figure out a way even if you didn't find a way that would work. I appreciate it!
RalphM, I am a mother of 4 who homeschools and is trying to manage these files to use in personal editing. I found this program a few months ago and am slowly started to use it in my free time. So telling me I "should have planned better," is like telling me the sky is blue. While both things are technically true, they are not really useful in my current situation and offer no actual help. I mentioned the fact the files vary so you would understand giving you actual file names probably wouldn't be useful. You will be thrilled to learn that after I realized it was happening, I changed my method of renaming such files to get rid of that space.
o7blue I didn't know there was an option out there like that. I will look into that option today as it looks like something I could use. I appreciate your suggestion.
highend I have no idea what that says/means but I will give it a try. Looks like I'm delving into the world of scripts today.
There are probably several ways to go about this so anyone has any other suggestions please feel free to keep adding to this. Thank You to everyone who took the time to figure out a way even if you didn't find a way that would work. I appreciate it!
-
jupe
- Posts: 3575
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: Space at end of file name
One way via GUI would be, assuming you already know how to only select all the files with a space at the end yourself easily (suggest: sel/live filter), would be to select them, then press F2 and enter
/cut -1 into the dialog, this would remove any char though not just a space.-
Loufubu7
- Posts: 6
- Joined: 28 Dec 2021 00:37
Re: Space at end of file name
jupe, that was the method I found but to find the files I was searching for (space).(extention) to find them. But I had to find them for every extention which was a bit of a work around but it worked at least. But selecting them all at once has proved difficult so far with this program. Howerver, I just looked up the selection options and was able to target all of them at once with your suggestion. so if I wanted to use this program it is in fact capable. It does tend to find others it should not and I'm not sure why but those are easy to deselect before completing the renaming. For smaller batches its ideal as I prefer to use 1 program when i can. Thank you very much!
o7blue I checked out that program and it is simply the fastest way to do this. I usually prefer to stay in one program when I can but theres no faster way to target that space and with the right boxes ticked it can do them all in seconds. I will look into the rest of its capabilities as well and am very pleased with how it performs.
I am still going to look into all of the suggestions (including the scripting from highend) from anyone that has more ideas. The more ways to fix things the better I learn the program.
o7blue I checked out that program and it is simply the fastest way to do this. I usually prefer to stay in one program when I can but theres no faster way to target that space and with the right boxes ticked it can do them all in seconds. I will look into the rest of its capabilities as well and am very pleased with how it performs.
I am still going to look into all of the suggestions (including the scripting from highend) from anyone that has more ideas. The more ways to fix things the better I learn the program.
XYplorer Beta Club