You are not logged in.
Hello,
is there a way that re-namer only counts files in a folder when there is only more than 1 file?
Thanks!
Offline
Hi and welcome, Karleesi.
Me think on default this is not possible, maybe by using an PascalScript.
Please tell us what you exactly like to do.
As far as I understood, you want to serialize your JPGs from 1 to x, individual for each folder?
And show us your current used rules (see context menu in Rules window > Export to Clipboard)
Perhaps somebody get an idea.
Maybe the key is to combine your tools?
First use TC to search for folders with more than one file, then select the resulting folders and drag&drop to ReNamer...
Not sure right now how to do that, though.
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Thanks for your reply. It's actually pretty basic:
I just want the files to be named like their folder they're in. Plus number them. But when there's only 1 file in the folder the counting doesn't make sense. It says (logically) file1.jpg then, for example. But no number needed because it's just one file in the folder.
I managed to do that, it looks like this.
FolderA:
File1, File2, File3
Files become: FolderA1, FolderA2, FolderA3
FolderB:
File1
file becomes: FolderB1
so the "1" is not needed because it's just one file anyway.
I've saved 2 settings now, 1 with numbering and 1 without numbering. Which means before renaming or using the software I have to sort all folders by 2 categories, "1 file folders" and "2 or more file folders". I'd like to skip that step.
I hope you understand me now.
Thanks for everything
The 2nd screenshot is for single files, the 1st for multiple files.
Offline
You could use the Pascal Script rule as the last rule to strip the serialization index from files which are sitting alone in their directory.
Is your serialization index appears at the end of the filename, just before the extension?
P.S. I do not understand the language in your screenshots. You can temporarily switch language to English and then export your rules to clipboard using the right-click context menu option.
Offline
Thank you. Can you tell me how to do that with the Pascal script?
"Is your serialization index appears at the end of the filename, just before the extension?"
Exactly. Like "File1.jpg"
Last edited by Karleesi (2020-05-10 11:06)
Offline
> Serialize only if more than one file in a folder
This is the script I need, perfect! But I have no idea how to do that!
Last edited by den4b (2020-05-10 18:32)
Offline
Yes, that script should do the trick for you. By default, it will strip all trailing digits and underscores from JPG files, but only if it is the only file in a directory.
You can adjust the FileMask and StripChars constants at the top of the script to suit your needs. Apart from that, you just need to add a Pascal Script rule with this script as the last rule in your list of rules.
const
FileMask = '*.jpg';
StripChars = '_0123456789';
var
Files: TWideStringArray;
begin
SetLength(Files, 0);
WideScanDirForFiles(WideExtractFileDir(FilePath),
Files, False, False, False, FileMask);
if Length(Files) = 1 then
begin
FileName := WideExtractFilePath(FileName) +
WideTrimCharsRight(WideExtractBaseName(FileName), StripChars) +
WideExtractFileExt(FileName);
end;
end.
Offline
Ok, thank you. Is there a way I can use that rule for every extension at the same time and not just .jpg? Let's say I have files with .jpg, .jpeg, .png, and so on. Thanks again.
Offline
Is there a way I can use that rule for every extension at the same time and not just .jpg? Let's say I have files with .jpg, .jpeg, .png, and so on.
Yes, just change the FileMask constant to "*" or "*.*", like follows:
const
FileMask = '*';
Offline