Sorting dd mm yyy date

Is Preferences / Folders / Folder Behaviour / Use 'descript.ion' file comments system instead of NTFS comments turned on or off?

What type(s) of drives are involved? (Network or local, USB or internal, FAT or NTFS, etc.)

[quote="leo"]Is Preferences / Folders / Folder Behaviour / Use 'descript.ion' file comments system instead of NTFS comments turned on or off?

What type(s) of drives are involved? (Network or local, USB or internal, FAT or NTFS, etc.)[/quote]

The option is On.

It is an NTFS internal hard drive.

I don't think anything in Opus should be creating descript.ion files at all in that case.

If there are existing descript.ion files then Opus may use & update them, however, and other applications may also create them.

Some more information. Occasionally when running the script I get a message which says something like (Opus then ends so I am relying on memory as to what the message said):

"Description field is only supported on NTFS drives. Would you like DOPus to create a descript.ion file?"

And I think in the past I might have replied Yes to this. So that would appear to be the reason why these files are being created.

I will reply No in future.

The problems seems to be that for some reason DOpus occasionally thinks that files on a NTFS drive are not on an NTFS drive.

I can't think of a reason why that would happen, unless something is failing in an unusual way due to the script setting lots of descriptions in parallel (since all the dopusrt commands will run asynchronously).

We'll have a better way to handle this in the future which will avoid that, if it's the cause.

If you have two files named

01-02-2013 Email Mr Jones to Mrs Smith
01-02-2013 Email Mr Jones to Mrs Smith – Attachment1

and they both have 2013-02-01 in the Description filed, and the Description field is sorted in ascending sequence, then the files appear in the above order.

This happens to be exactly what I want. But I am curious as to why this is so.

Where two files have exactly the same value in the sort field, does DOpus automatically use the Name field as a tie-breaker?

Yes. (More or less. The exact rules may be more complicated than that, but it's basically true.)

Yes. (More or less. The exact rules may be more complicated than that, but it's basically true.)[/quote]

I have been carrying out a few tests and it seems that:

  1. If you sort - ascending - on Description, Size, or Type (and I presume on most other fields though I haven't tried), tie-breakers are are listed in ascending Name order

  2. If you sort - descending - on Description, Size, or Type (and I presume on most other fields though I haven't tried), tie-breakers are are listed in descending Name order

  3. But if you sort - ascending - on Date Modified, tie-breakers are are listed in descending Name order

  4. But if you sort - descending - on Date Modified, tie-breakers are are listed in ascending Name order

Is this behaviour for Date Modified intentional?

The date/time fields sort largest (most recent) to smallest (most ancient) by default, while most other fields like name sort smallest (A) to largest (Z).

The default sort order for each column can be seen and changed under Preferences / Display / Fields.

(This is starting to feel like a trivia quiz. As long as the sort-order remains stable -- i.e. unchanged files do not switch positions each time you refresh -- the rules for breaking a tie on the main sort column are arbitrary.)

Note that Opus allows you to do explicit multi-column sorting, so you can choose which columns, in which order, and in which direction(s), the sort uses when the primary sort column is a tie, overriding the default behaviour if you don't like it.

[quote="leo"]The date/time fields sort largest (most recent) to smallest (most ancient) by default, while most other fields like name sort smallest (A) to largest (Z).

The default sort order for each column can be seen and changed under Preferences / Display / Fields.

(This is starting to feel like a trivia quiz. As long as the sort-order remains stable -- i.e. unchanged files do not switch positions each time you refresh -- the rules for breaking a tie on the main sort column are arbitrary.)

Note that Opus allows you to do explicit multi-column sorting, so you can choose which columns, in which order, and in which direction(s), the sort uses when the primary sort column is a tie, overriding the default behaviour if you don't like it.[/quote]

Sorry if it feels like a quiz, I'm just trying to understand how it works more generally at the same time as solving the particular issue when sorting with Date Modified!

Essentially what I would like to be able to do for a certain folder is to sort on Date Modified (ascending) - i.e. latest dates at the bottom, and have the tie breaker resolve like this:

01-02-2013 AAA
01-02-2013 AAA - A
01-02-2013 BBB

The problem is that the tie breaker resolves like this:

01-02-2013 BBB
01-02-2013 AAA - A
01-02-2013 AAA

You say that Opus allows explicit multi-column sorting and you provide a link to a page headed Sorting and Grouping. Multi-column sorting sounds just what I need but as far as I can see the page you link to describes having a single sort column and using Group By. As far as I can see Group By is not actually the same as having a secondary sort column because Group By chooses for itself the value range for the group and only then puts the groups in order. So the files above all get put in a single group named 0-9, and the files still appear like this:

01-02-2013 BBB
01-02-2013 AAA - A
01-02-2013 AAA

As far as I can see default sort order (as distinct from currently selected sort order) doesn't affect anything. I have changed the default sort order for Date Modified using Preferences / Display / Fields but that does not assist.

Search the page Leo linked for the word "multiple".

Thank you - not sure how I missed that.

However I still can't get it to work - see below






It appears that when you sort on Name as a second sort column, it is not correctly sorting.

Are you sure the times are really identical? What do you see if you turn seconds on?

You are right. It is the hidden seconds which accounts for the difference.

Unfortunately in the application I am thinking of, there will nearly always be a second or two difference between the two or three files I want to treat as timed the same - essentially what I want to do is sort on date-hour-minute (or just date) as the first sort field, but I guess that isn't possible.

[quote="leo"]I can't think of a reason why that would happen, unless something is failing in an unusual way due to the script setting lots of descriptions in parallel (since all the dopusrt commands will run asynchronously).

We'll have a better way to handle this in the future which will avoid that, if it's the cause.[/quote]

After the script has finished running, the files which do not have Desc set (which must be those which trigger these messages) seem to be the ones with the longest pathnames, the very longest being 278 characters in length.

I don't know whether this has something to do with it.

It may. A lot of things, not just in Opus but throughout Windows, will start to fail once the path goes above 259 characters. Parts of the Win32 API cannot use paths longer than that.

Renaming the files/folders to reduce the path length is strongly advised, and not just for Opus. (The key parts of Opus will work with arbitrarily long paths, but we make no guarantees about more esoteric features, and indeed cannot make guarantees since they may depend on Windows APIs or 3rd party code with path length limits.)

In another thread earlier today, someone had a problem that their script was processing all files displayed - they wanted it to just process selected files.

The script which steje kindly wrote - and you and blueroly - amended, only processes selected files but it would be better if it processed all files (i.e. the problem in the previous thread in reverse).

It that possible?

Following a suggestion on another post, I have tried changing the Sort dd-mm-yyyy button to use FROM so that it works on all files listed (whether they are selected or not)

<?xml version="1.0"?> <button backcol="none" display="both" label_pos="right" textcol="none" type="three_button"> <label>Sort dd-mm-yyyy ALL</label> <icon1>#default:recentlistclear</icon1> <button backcol="none" display="both" label_pos="right" textcol="none"> <label>Sort dd-mm-yyyy</label> <tip>Use a dd-mm-yyyy filename string to set a yyyy-mm-dd Description field value.</tip> <icon1>#default:recentlist</icon1> <function type="normal"> <instruction>Set SORTBY=name </instruction> <instruction>Rename FROM *.* PATTERN=&quot;*&quot; TO=&quot;*&quot;</instruction> <instruction>Set SORTBY=desc </instruction> <instruction>@script vbscript</instruction> <instruction>Option Explicit</instruction> <instruction>&apos; For information on the technique used in this button see:</instruction> <instruction>&apos; &quot;Abusing&quot; Rename Scripts to do other things with file info</instruction> <instruction>&apos; https://resource.dopus.com/t/abusing-rename-scripts-to-do-other-things-with-file-info/5969/1 <instruction>&apos; Change the path below if you haven&apos;t installed Opus to the default location:</instruction> <instruction>dim DOpusRTPath</instruction> <instruction>DOpusRTPath = &quot;%ProgramFiles%\GPSoftware\Directory Opus\dopusrt.exe&quot;</instruction> <instruction>Dim Shell</instruction> <instruction>Set Shell = CreateObject(&quot;WScript.Shell&quot;)</instruction> <instruction>Dim re</instruction> <instruction>Set re = new RegExp</instruction> <instruction>Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)</instruction> <instruction> Dim strDate</instruction> <instruction> Dim strCommand</instruction> <instruction> &apos; Set strNewName to an empty string so that Opus does not rename the file.</instruction> <instruction> strNewName = &quot;&quot;</instruction> <instruction> re.IgnoreCase = True</instruction> <instruction> re.Global = False</instruction> <instruction> &apos; The strFileName, we have should be something like &quot;29-07-2011 other_filename_text.ext&quot;</instruction> <instruction> re.Pattern = &quot;(\d\d)-(\d\d)-(\d\d\d\d)(.*)&quot;</instruction> <instruction> If (re.Test(strFileName)) Then</instruction> <instruction> &apos; Set strDate to a string like &quot;2011-07-29&quot;</instruction> <instruction> strDate = re.Replace(strFileName, &quot;$3-$2-$1&quot;)</instruction> <instruction> &apos; DOpus.OutputString &quot;DT = &quot; &amp; strDate</instruction> <instruction> strCommand = &quot;&quot;&quot;&quot; &amp; DOpusRTPath &amp; &quot;&quot;&quot; /cmd SetAttr FILE=&quot;&quot;&quot; &amp; strFilePath &amp; &quot;\&quot; &amp; strFileName &amp; &quot;&quot;&quot; DESCRIPTION=&quot;&quot;&quot; &amp; strDate &amp; &quot;&quot;&quot;&quot;</instruction> <instruction> &apos; DOpus.OutputString &quot;CMD = &quot; &amp; strCommand</instruction> <instruction> Shell.Run strCommand,0,true</instruction> <instruction> End If</instruction> <instruction>End Function</instruction> </function> </button> <button backcol="none" display="both" label_pos="right" textcol="none"> <label>Clear Desc</label> <icon1>#default:recentlistclear</icon1> <function type="normal"> <instruction>Set SORTBY=name </instruction> <instruction>SetAttr SETDESCRIPTION</instruction> </function> </button> </button>

This seems to work generally. However for some reason it does not work at all if the lister is in Flat View

I think on balance having the button so that it works even without selecting the files is much better - given that its object is to sort the files there is no logic in requiring the files to be selected. Even if it does not work in Flat View I think overall it is still better...

But it would be nice to know why it doesn't work in Flat View. Anyone got any ideas?