Rename - a little complex

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Rename - a little complex

Postby uraniumbreather » Sat Nov 04, 2017 9:14 pm

Some screenshots have names like this:

Screen Shot 2017-09-16 at 23.33.54 1
Screen Shot 2017-09-16 at 23.33.54 2
Screen Shot 2017-09-16 at 23.33.54 3
Screen Shot 2017-09-16 at 23.33.54

Windows organises them like this. I need them organised so that the last one (without the number at the end) is first (It is in fact the first file. The screenshots are taken on a Mac, then they've been transferred to a Windows machine. Windows does this to the files.

At the moment what I am doing is manually going through and adding a '0' at the end. This is a long process and often I miss files (I have over 15k files).

Sometimes there can be up to 4 (so 1, 2, 3, and 4 added at the end of the file names). Sometimes there is only 1. Other times there are 2 or 3. So we need to take into account that the number of files created isn't fixed and can vary.

There are files in that folder with different times and dates that do not have any numbers at the end (multiple screenshots that were not taken in quick secession, so they fall outside of the same 1 second).
Now those files do NOT need to be altered. It's only the files that have no number but are part of screenshots taken within the same second.

Is there a quicker way to do this using Bulk Rename?

Thanks
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby therube » Sun Nov 05, 2017 2:25 pm

Except for this little point:
There are files in that folder with different times and dates that do not have any numbers at the end


This would have done it:

1:RegEx:
Code: Select all
Match:  (^.* \d\d.\d\d.\d\d$)
Replace:  \1 0
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename - a little complex

Postby therube » Sun Nov 05, 2017 3:25 pm

Everything

Code: Select all
regex:(^Screen Shot.*\s\d\d\.\d\d\.\d\d\s1$)


That will find all "Screen Shot.*" "1" files.
For all of those files, there should be a corresponding file without any 1, 2, 3...

So if you have a list of all "1"'s, & you export that list (from Everything),
edit it removing the " 1" from the end of the filename,
you should then have a list of all files that you need to rename - excluded are files that have no corresponding 1, 2, 3...

With that list... once finagled...

You could then use BRU's Renamed Pairs feature...
Last edited by therube on Sun Nov 05, 2017 3:31 pm, edited 2 times in total.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename - a little complex

Postby therube » Sun Nov 05, 2017 3:29 pm

(I'd suspect you could do similar with BRU's JavaScript Renaming..., but that is beyond me.)
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename - a little complex

Postby uraniumbreather » Thu Nov 09, 2017 1:32 pm

Thank you for all those that have replied.

therube - can you dumb it down for me please? Thanks.
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby KenP » Thu Nov 09, 2017 2:40 pm

That's a good idea by therube for getting a list of the file names that need renaming, but instead of installing and using "Everything" you could use the filters in BRU to get the list.

Filters (12)
Mask: .*\d{2}\.\d{2}\.\d{2}\s1\.png
RegEx: Selected
    (this is assuming the screen-shots have png file extensions)

Now select all the filtered files and from the right click menu select "Clipboard Copy / Filename + Ext", now paste the list into a text document and edit out the spaces and 1s immediately before the file extensions.
You can now use this list to make the text file for "Actions / Import Rename-Pairs...".

If you use Notepad++ you can easily delete all the spaces and 1s immediately before the file extension by using multiple cursors (click before the space in front of the 1 in the first line then Shift+Alt+down arrow).
KenP
 
Posts: 199
Joined: Sat Jul 30, 2016 11:25 am

Re: Rename - a little complex

Postby uraniumbreather » Sat Nov 11, 2017 4:49 pm

I think you all don't understand (or I don't understand you all).

The files ending with numbers do not need to be moved or renamed.

The file within the same second that was not given a number when it was created by the software (not bulk rename but the screenshotting software or Mac's own built in screenshotter) are the files that need to be renamed, such that they are first.

So if we have ending in:
54
54 1
54 2
54 3
54 4

That is how the software creates the file names right. BUT that is on the mac. Once they are transferred to a windows machine, windows reorganises them such that the file ending in the example given (54 with no number at the end) becomes the last file.

So the order now looks like this once transferred to the PC:
54 1
54 2
54 3
54 4
54

I need to get it back so that it is 54 first as that is in fact the first file that was created with 54 referring to the exact second the file was made).

All screenshots are in the same folder and need to remain in the same folder.

Thank you
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby uraniumbreather » Sat Nov 18, 2017 2:51 pm

hello?
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby Panchdara » Sun Nov 19, 2017 10:41 am

@uraniumbreather

I just "touched" these files in a sub dir and the order was as expected.

:: Batch file
touch "Screen Shot 2017-09-16 at 23.33.54 1"
touch "Screen Shot 2017-09-16 at 23.33.54 2"
touch "Screen Shot 2017-09-16 at 23.33.54 3"
touch "Screen Shot 2017-09-16 at 23.33.54"
:: End batch file

Image

So, not sure what you mean now. Win 10
Panchdara
 
Posts: 67
Joined: Sat Jan 09, 2016 7:25 pm

Re: Rename - a little complex

Postby uraniumbreather » Mon Nov 20, 2017 3:36 am

Panchdara wrote:@uraniumbreather

I just "touched" these files in a sub dir and the order was as expected.

:: Batch file
touch "Screen Shot 2017-09-16 at 23.33.54 1"
touch "Screen Shot 2017-09-16 at 23.33.54 2"
touch "Screen Shot 2017-09-16 at 23.33.54 3"
touch "Screen Shot 2017-09-16 at 23.33.54"
:: End batch file

Image

So, not sure what you mean now. Win 10


What do you mean touched?

And I am using Windows 7. Also there is no bat file for me obviously. What did you do?
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby therube » Mon Nov 20, 2017 5:32 pm

Touch changes the file date, so unless you are sorting by date it is immaterial.


Some screenshots have names like this:

Screen Shot 2017-09-16 at 23.33.54 1
Screen Shot 2017-09-16 at 23.33.54 2
Screen Shot 2017-09-16 at 23.33.54 3
Screen Shot 2017-09-16 at 23.33.54

Windows organizes them like this.


What OS?
I don't see that in XP or Win7.
(I know nothing of Win10 nor if something like a language pack or similar would make a difference.)

Sorted by name, I see:
Screen Shot 2017-09-16 at 23.33.54
Screen Shot 2017-09-16 at 23.33.54 1
Screen Shot 2017-09-16 at 23.33.54 2
Screen Shot 2017-09-16 at 23.33.54 3

That holds in Windows Explorer & various file managers, in both alpha & "natural" sorts (by name).

So if your only real issue is the order the filenames are displayed, look into what may be causing them to be displayed differently (like perhaps if sorted by date, where the the Shot without the appended # happens to be dated later).
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename - a little complex

Postby uraniumbreather » Tue Nov 21, 2017 4:23 pm

therube wrote:Touch changes the file date, so unless you are sorting by date it is immaterial.

->>>>> What is touch and what does immaterial mean?

Some screenshots have names like this:

Screen Shot 2017-09-16 at 23.33.54 1
Screen Shot 2017-09-16 at 23.33.54 2
Screen Shot 2017-09-16 at 23.33.54 3
Screen Shot 2017-09-16 at 23.33.54

Windows organizes them like this.


What OS?
I don't see that in XP or Win7.
(I know nothing of Win10 nor if something like a language pack or similar would make a difference.)

Sorted by name, I see:
Screen Shot 2017-09-16 at 23.33.54
Screen Shot 2017-09-16 at 23.33.54 1
Screen Shot 2017-09-16 at 23.33.54 2
Screen Shot 2017-09-16 at 23.33.54 3

That holds in Windows Explorer & various file managers, in both alpha & "natural" sorts (by name).

So if your only real issue is the order the filenames are displayed, look into what may be causing them to be displayed differently (like perhaps if sorted by date, where the the Shot without the appended # happens to be dated later).


->>>>> What is the Shot? and the appended? and hash tag happens to be?
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby therube » Tue Nov 21, 2017 5:45 pm

touch command is (basically) used to change a files date/time.
If you were sorting files & if they were sorted by date, if you "touched" each file in sequence, then one should be dated (slightly) after the other, & so end up "sorted" in a manner to meet one's needs.

Immaterial means that if you are not sorting files by date (I expect you're sorting them by name, ascending), then the date of the files does not matter - is not involved in the sort.

If sorting by name, ascending, then I'm not sure how you're showing the files in the particular order you have in your first post.
(Unless the file with no appended # has some other, not seen, character in there?)


->>>>> What is the Shot? and the appended? and hash tag happens to be?

You're loosing me there?

Oh, this one?
where the the Shot...

I just didn't type out "Screen Shot 2017-09-16 at 23.33.54"
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Rename - a little complex

Postby uraniumbreather » Wed Nov 22, 2017 2:18 am

therube wrote:touch command is (basically) used to change a files date/time.
If you were sorting files & if they were sorted by date, if you "touched" each file in sequence, then one should be dated (slightly) after the other, & so end up "sorted" in a manner to meet one's needs.

Immaterial means that if you are not sorting files by date (I expect you're sorting them by name, ascending), then the date of the files does not matter - is not involved in the sort.

If sorting by name, ascending, then I'm not sure how you're showing the files in the particular order you have in your first post.
(Unless the file with no appended # has some other, not seen, character in there?)


->>>>> What is the Shot? and the appended? and hash tag happens to be?

You're loosing me there?

Oh, this one?
where the the Shot...

I just didn't type out "Screen Shot 2017-09-16 at 23.33.54"



Does touching mean that the file name remains intact?
uraniumbreather
 
Posts: 21
Joined: Tue Oct 10, 2017 11:54 am

Re: Rename - a little complex

Postby Panchdara » Wed Nov 22, 2017 9:21 am

Hi. Sorry - thought "touch" was a common utility amongst most peoples arsenals.

Touch is a UNIX type utility that will create a file, if not in existence, or change the modified date/attributes if it does.

I created a batch file "tt.bat" that contains the touch lines is all. This batch file created the files as OP has listed. The OP must have some alternate sorting sequence or has duff characters at end of file name.

I am using Win 10 Creators but have a touch utility from the GitBash install - but touch can be downloaded anywhere - there are many to choose from.
Panchdara
 
Posts: 67
Joined: Sat Jan 09, 2016 7:25 pm

Next

Return to BRU Support