Anyone help me with this script please?

Advanced Renamer forum
#1 : 14/07-17 21:02
MrHants
MrHants
Posts: 18
I have a list of say 9k image files, and many of them are missing the" date taken" metadata, preventing me from renaming them based on this info.

Consequently, their new filenames would display as --.jpg, and duplicates of these dont trigger an error. I cant group them together, as I cant sort based on any of the columns, and trying to manually do this in such a big list would take forever.

Is there are way to group or exclude such files so I can then mark/move them before processing the list for renaming?


14/07-17 21:02 - edited 26/07-17 19:13
#2 : 14/07-17 22:32
Rick
Rick
Posts: 7
Reply to #1:
If you are working from a script, you can test for the lack of data and then return null. A null return value stops the script from renaming the file.

Adding a test like:

if (dateTaken === '') {
return;
}

before you construct whatever you would normally return should work.


14/07-17 22:32
#3 : 15/07-17 21:49
MrHants
MrHants
Posts: 18
Reply to #2:

Thanks Rick, Ill give it a go! Although, I may have found a workaround, by adding the "Date Taken" column, which is sort-able... so it then moves any without this filed to the top!

*** Just spotted that theres still groups of files scattered throughout the list without the Date Taken info, so the Sort isnt doing what I had hoped/expected, so will give the script a go!

Is there any reason that some of the columns are sort-able, but not others?

It seems that in previous uses of AR, I hadn't spotted that some files didn't have the Date Taken field in, hard to scan through large lists of files, so now have files that are called --.jpg. Not really sure how this happened as they were successfully moved to Folders based on the date taken, so dont really understand why this info seems to now be missing, but nevermind!

Cheers




15/07-17 21:49 - edited 15/07-17 21:57
#4 : 15/07-17 22:07
MrHants
MrHants
Posts: 18
Reply to #2:

Did have to modify script slightly.. worked, thanks!

if (dateTaken ='') {
return;
}


15/07-17 22:07
#5 : 16/07-17 15:11
Rick
Rick
Posts: 7
Reply to #4:
That shouldn't work for what you are trying to do as it is an assignment statement. In JavaScript the equals operator '=' is used to give a variable a value. The comparison operator is '==='. What does your entire script look like?


16/07-17 15:11
#6 : 22/07-17 21:21
MrHants
MrHants
Posts: 18
Reply to #5:

Sorry, my mistake, thought it had worked...

Using your script, I see the error:

"Invalid script Line 2: Date taken is not defined"

Cheers


22/07-17 21:21
#7 : 11/08-17 16:05
MrHants
MrHants
Posts: 18
Anyone able to help?

Would even be good if it returned an error, after all, I am asking to rename a file based on metadata that doesn't exist.

Thanks


11/08-17 16:05