Can you automate adding descriptions (comments) to files?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Andante
Junior Member
Junior Member
Posts: 41
Joined: 2018-01-31, 01:38 UTC

Can you automate adding descriptions (comments) to files?

Post by *Andante »

I have a list of long descriptions to be added to a folder full of historical photos. Is there a way to add them all at once? (I know we can change multiple file names all at once....)
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

FAQs: File comments descript.ion (descriptions Ctrl+Z)

Post by *Stefan2 »

Andante wrote: 2019-05-08, 21:55 UTC I have a list of long descriptions to be added to a folder full of historical photos. Is there a way to add them all at once? (I know we can change multiple file names all at once....)
I changed my answer to a little faq with topics I found on this forum


<<< German / Deutsch am Ende dieses Postes >>>



Files can have a "comment", stored in a file called "descript.ion".
(see such file in TC-folder (use F4 key to read), and take a look into the "Show"-menu also)
TCMDX32.EXE 64-bit to 32-bit tool (for context menu)
TCMDX64.EXE 64-bit shell extension support for right click context menu
TOTALCMD.INC Command strings for menu and button bar
UNRAR.DLL RAR unpacker DLL for Windows XP or newer



That idea was used and so made well-known by jpsoft for their programs 4NT and Take Command.
This concept is independent form the windows file system and WindowsExplorer or any other application,
but then there could be other application who can work with such an "descript.ion" from TC too.
That said, at first, the line length was limited to 512 characters, but from 2008 (v7.5) on TC start to extent that concept
and also start to use its own ID (0xC2) to mark comments containing line breaks,
so other applications may not be able to read the whole information from the comments.
Since v7.5, TC supports comment lengths of 4 kBytes minus name length, a space, and the extra fields.



The descript.ion file (where the comments are stored, one file for each folder) is just a text file.

So just add two or three comments,
next open the descript.ion file with F4 or your preferred text editor and see how it is structured,
next add your other information to that file and save it.


Individual; each file its own comment
Example:
- Ctrl+Z on a file
- Add your comment
- F2 to save
- Ctrl+Z on that file to read the comment ((( or see SHOW menu > Comments )))

Example comments:
Filename SPACE Comment
"File name" SPACE Comment


To automated the process:
- Go to your folder
- Open a DOS-Box: MENU Commands > Open command prompt window
- Launch PowerShell: powershell <ENTER>
- Type: dir -File|ForEach{"""{0}"" " -f $_.Name}>descript.ion.TXT
((( That is: " " " {0} " " ~space~ " -f )))
- Open descript.ion.TXT with your text editor, add your comments
- Save as descript.ion
Done

With a good text editor and column selection mode that would be not much of an problem.
(((Notepad2 or EmEditor)))



Or utilize a spreadsheet program like Excel:
- Paste your file list in column A
- Paste your comments in column B
- In column C enter a formula: =""""&A1&""""&" "&B1
((( or: =""""&A1&""" " &B1 - - - - That is: " " " " & A1 & " " "~space~" & B1 )))
- Copy that formula form C1 down the rows of column C
- Select whole "C"-column and paste into descript.ion txt file
Done




Please also note that TC adds the hidden attribute to that descript.ion txt file if TC creates it on its own.


HTH? :D


- - -


- - - Some more information, found on this forum:


Add the SAME comment to several selected files

- Select one or more files
- MENU Files -> Change Attributes...
- [x] Change Plugin attributes:
- [More attributes]
- | tc | comment | your text here |
[OK]

- - -


To view Comments:
- Ctrl+Z on one file
or
- "SHOW menu > Comments" to get a one column for to see all comments
or
- Create a "user defined column"-view with "Name | Ext. | tc.Comment | tc.Size | tc.Date"
>> "Custom columns" >> http://www.ghisler.ch/wiki/index.php/Custom_columns
>> (as comment you could just write Stars like *****, or **, ... to categorize favorite files)
or
- You can search for comments via [Plugins] and tc |Comment | contains | *****
or
- You can color files with an specific comment


- - -

TC can copy file comments on file copy / synchronization too.

See MENU Configuration > Options > Operation > on the bottom at "File comments" >> [x] Copy comments with files

If you choose this option, the descript.ion files themselves will not be copied.
Instead, the comments will be copied when the files are copied.
Otherwise the descript.ion files will be treated like normal files.

TC will not copy comments if the file to copy is already existend in target, because TC doesn't know which comment would be newer / the wanted one.



ToDo, more details...
Add or remove a comment with one single AutoHotkey script
and color files with such comment in a different color (like "red")

Set File Comment Automate >> https://ghisler.ch/board/viewtopic.php?f=3&t=52620








File format



TC can work with files named "descript.ion" and "files.bbs" for to store file comments.

TC will use the one it finds in a directory.
If there is none, or both, it will use the preferred type.
See MENU Configuration > Options > Operation > on the bottom at "File comments" >> Plain text / Unicode / UTFxxx

- - -

File format and line length limit

At first, the line length was 512 characters, and do not support any line breaks. But then:

http://jpsoft.com/ascii/descfile.txt
The characters after the description allow extension of the description format for use by other programs.
They are as follows: * is an ASCII Ctrl-D (04), and marks the end of the description text and the beginning of information for a program other than 4NT or Take Command.
<ID> is an identification byte for the program which is using this area of the particular line.
If you are writing a program which will store information in DESCRIPT.ION, test it using an ID byte of your own choosing.
The line length limit is 4096 bytes; exceeding this limit will cause unpredictable results.


Post by *van Dusen » Mon Oct 02, 2006 20:12
My interpretation of the file format description was:

A line in descript.ion (a "record") may be terminated by
* 0x0D (a single CR) or
* 0x0A (a single LF )or
* 0x0D0A (CRLF) or
* 0x26 or
* the physical end of the file

The begin of an area for other program info is indicated by 0x04 (Ctrl-D).

The description and other program info may not contain
* Ctrl-D,
* CR,
* LF,
* NUL (0x00).
Don't know why 0x26 is not listed in the specification, but since 0x26 should be interpreted as "end of line",
it must be a "forbidden" character too, IMO.

In order to mark line breaks within the comment text, a character or a string must be used for substitution,
which is not "forbidden" according the list above. Unfortunately all other characters may occur as user data.
Thus, it would be sensible to make this substition character (or string) configurable. "\n" would be a good choice because of its common meaning.
(But the current implemention causes unwanted / unexpected results, when using "\n" within the description.)

For the script "TCEditCommentExtended" I have recommended to use 0xA0 as substitution character. 0xA0 is a NBSP (non-breakable space... paradox, to misuse it as line break, isn't it? ;) ).
Because NBSP is a white space, it isn't conspicuous, when the description should be displayed in a single row (comment view in the file list, for instance).

You can get V0.3.0 of TCEditCommentExtended here: https://ghisler.ch/board/viewtopic.php?p=93042#p93042
TCEditCommentExtended_0.3.0.zip (488 KiB)



by *ghisler(Author) » Mon Mar 24, 2008 17:47
TC 7.5 will support comment lengths of 4 kBytes minus name length, a space, and the extra fields (the maximum allowed according to the new descript.ion documentation).
I also have my own ID now (0xC2), which I will use to mark comments containing line breaks. 0xA0 will not be used, instead I will use \n for line breaks and \\ for backslashes (only of 0xC2 is present).

- - -

by *ghisler(Author) » Fri Oct 07, 2016 12:23
https://ghisler.ch/board/viewtopic.php?p=318281#p318281

Q: TC 9.0b17, unexpected bytes 04 C3 82 in descript.ion in case of multi line comment?

A: These are not a bug. They are an extension of the descript.ion format:
Normally the descript.ion format does not support line breaks.
I have therefore registered an extension with the creators of descript.ion which supports line breaks.
It works like this:
descript.ion extensions are at the end of each the line, separated by character 04.
My extension has code C2.
If this extension 04 C2 is present, all character pairs \n will be replaced by <CR><LF> line breaks.

Now C2 is the code used in ANSI, OEM, and UTF-16 encodings.
However, C2 is not a valid character code in UTF-8.
Therefore I convert the UTF-16 code C2 to UTF-8, which gives the code pair C3 82.

- - -

https://ghisler.ch/board/viewtopic.php?f=16&t=44798&hilit=descript.ion&p=313040#p313040
[9.0x] Why is there 'DOS charset' option for comments?

Post by *MVV » Fri Jul 08, 2016 9:42
Since in TC 9 there is a combobox with a list of desired comment encodings, why is there the 'DOS charset' option which is completely useless now?
###
Post by *petermad » Fri Jul 08, 2016 13:09
No, there is a difference detween DOS charset and Plain text from the dropdown box. DOS charset is ASCII encoded while Plain text is ANSI.
Try this:
Set the preferred type to "Plain text". Find a folder without any descript.ion file. Add a comment to a file using non-English characters as for example: æøåÆØÅ
Go to options and check the "DOS charset" box and then look at the comment in TC's file panel - it shows up as µ°ÕãÏ┼

Or the other way around: Delete the descript.ion file again. Try adding a comment again with æøåÆØÅ - notice that only ØÅ is visible the rest is spaces. Delete the spaces and save the ØÅ comment. Now remove the checkmark for "DOS charset". Mow the file comment show up a blank in TC's file panel.
###
Post by *MVV » Fri Jul 08, 2016 16:58
So maybe just add another encoding for descript.ion files into drop-down list? Especially since DOS checkbox has only sense for descript.ion files...
###
Post by *ghisler(Author) » Mon Jul 11, 2016 9:47
This is intentional and will not be changed. It's meant for users who have very old descript.ion files in DOS format.
###
by *ghisler(Author) » Wed Jul 13, 2016 22:27
OK, I checked this now: It's necessary to have it separate for the case where a mode like "Unicode" or "files.bbs" is chosen, which doesn't say anything about reading from plain text descript.ion files. The combobox is all about WRITING descriptions.
###
by *MVV » Wed Jul 13, 2016 23:35
So 'DOS charset' means reading OEM-encoded files? And what does mean 'Read from both' option? Current layout is not clear too much...
###
by *ghisler(Author) » Thu Jul 14, 2016 12:16
DOS charset means that when TC encounters a plain text descript.ion file, it treats it as having DOS charset for reading and writing.
Read from both means that TC will look for comments in both descript.ion and files.bbs files, independent of which is chosen in the combobox as the standard format.
###







Tips:


patxiku wrote: 2017-01-20, 15:20 UTC Tags using Comments
https://ghisler.ch/board/viewtopic.php?p=324351#p324351
Post by *patxiku » Fri Jan 20, 2017 16:20

As it is said in this tread the internal alternative for Tags of TC are COMMENTS and there can be placed Tags by using Tag1; Tag2….
It is not so simple to get a good performance of them. I will explain how to use them.

General use:
A simple comment is created by pressing Ctrl-Z on a file in a TC’s panel.
A new window is opened to edit it and it will be saved by pressing F2. Add Tags there.

All the comments of a folder are saved in a file called descript.ion.

To see the comments in the files panel, it can be created a Customized column View (Shift-F1)
and include a column with the comments of each file using plugins (e.g. tc.comment).

The comments are copied or moved together with files when they are copied or moved using TC.
(To activate this option: Configuration> Options> Operation> Copy comments with files).


Tags Search using comments:
Method 1: You can compose Tags searches in Search's Plugins tab and there add tc plugin, comment property and the desired Tag in value.
Once search is done, it can be used “Feed to listbox” button for getting in the active panel the files that contain those Tags.

Method 2: It is possible to use the Quick Search (Ctrl-S) with tags in comments if it is installed the wonderful
Samuel's utility QuickSeach eXtended
in combination with a wdx plugin like File Descriptions.
If this method is used together with the Branch view (Ctrl-B) to see all the files of a folder and its subfolders,
they can be obtained quite satisfactory results.


Tags Edition through comments.
Individual edition is very simple as said before, pressing the mentioned Ctrl-Z.
It is possible to put simple comments to several files simultaneously using Atributes Changie in File menu.
With the option “Change attributes with plugin” checked and “More attributes" button they can be changed comments.
Add tc.comment, and the desired comment in value. The disadvantage is that it replaces all the preexisting comments,
and they cannot be added tags to previous comments. Althougt, they can be erased already registered ones.

Then the solution in a specific folder is edit directly the descript.ion file with a pure text editor like Notepad.
(Descript.ion is a hidden file, perhaps it cannot be seen if Show hidden files isn't activated in Configuration > Display).

More complex Multiple file comments still are not possible in TC. I’m developing an Autohotkey script for making this possible,
but it could be very useful if Mr. Ghisler would add it to next version. It could be like the very useful MultiRename Tool.
- - -

Sort file list by Comments

https://ghisler.ch/board/viewtopic.php?f=3&t=51337&p=348999&hilit=descript.ion#p348999
Re: select multiple files by using filename list txt and sort the selected files as the same order as the filename txt

Post by *Stefan2 » Fri Nov 23, 2018 12:47

Hi and welcome. For example:

Files can have a "comment", stored in file "descript.ion" (see such file in TC-folder, and take a look into the "Show"-menu also)

- Create a such text file "descript.ion" on your own like:
Filename SPACE NUMBER
"File name" SPACE NUMBER

CABRK.DLL 2
DEFAULT.BAR 4
NOCLOSE.EXE 5
TOTALCMD.EXE 1
UNRAR.DLL 3


- Next create a "user defined column"-view with Name | Ext. | Comment | Size | Date
"Custom columns" >> http://www.ghisler.ch/wiki/index.php/Custom_columns


- Then you can click the header of the Comment-column to sort by comment >>> 1, 2, 3, 4....

TOTALCMD.EXE 1
CABRK.DLL 2
UNRAR.DLL 3
DEFAULT.BAR 4
NOCLOSE.EXE 5


- - -
Stefan2 wrote: 2019-11-07, 21:48 UTC
brahman wrote: 2019-11-06, 16:58 UTC would anyone know of an easy and free way to convert a descript.ion file to a text file
with proper line end formatting instead of all the \n stuff
which I am seeing right now, when I simply rename the .ion file to a .txt file?


To replace "\n" text sign to actual real line break, use in Notepad++
Search for: \\n
Replace with: \r\n
(o) Regular expression



Since we use RegEx to be able to replace by a line break (\r\n),
we have to escape the char "\" of the literal "\n" by doubling it to "\\" (because it is a RegEx meta char).

If you don't need RegEx at all (f.ex. just replacing "\n" by e.g. "#" or an space), you can search for literal "\n" without doubling .




HTH? :D







German / Deutsch



Einer ausgewählten Datei (bzw. Ordner) einen DateiKommentar geben
- Datei markieren
- Strg+Z
- Trage deinen Kommentar ein
- F2 zum abspeichern

Allen ausgewählten Dateien (bzw. Ordner) den gleichen DateiKommentar geben
- Eine oder mehrere Dateien auswählen
- Menü "Dateien > Dateiattribute ändern..."
- [x] Pluginattribute ändern:
- [Mehr Attribute]
- | tc | Kommentar | deinKommentarHier |
[OK]

DateiKommentar(e) anzeigen
- Datei (bzw. Ordner) markieren
- Strg+Z
- -oder-
- Über Menü "Ansicht > Kommentare" als Spalte anzeigen lassen (Strg+Umschalt+F2)
(Bei Bedarf auch vorher Menü "Befehle > Zweigansicht", um alle DATEIEN (KEINE Ordner) in allen Unterordner anzeigen zu lassen)

DateiKommentare suchen
- Suche
- [Plugins]
- - [x]Suche in Plugins
- - tc | Kommentar | enthält | TeilEinesGesuchtenKommentars
- [Suche starten]
- Im Suchergebnis, unten rechts auf [anwenden] klicken für eine normale Listenansicht mit allen Möglichkeiten,
oder auf [gehe zu] um zu einem einzelnem Suchergebnis zu springen.


Kommentare mit den Dateien mitkopieren
Menü "Konfigurieren > Einstellungen... > Operationen > Dateikommentare" >> [x] Kopiere Kommentare mit den Dateien


DateiKommentarvergabe automatisieren
Kommentare werden (standardmäßig) in der Textdatei Namens "descript.ion" abgelegt.
Diese Textdatei wird beim ersten Gebrauch in jedem Ordner erstellt, welcher eine kommentierte Datei (bzw. Ordner) enthält.

Wenn du den Aufbau der descript.ion einmal verstanden hast, kannst du diese auch
von Hand editieren und alle Datei- bzw. Ordnernamen nebst Kommentar in einem Rutsch eintragen:

Beispiel Kommentare:
Dateiname.ext SPACE DeinKommentar
"Dateiname mit Leerzeichen.ext" SPACE DeinKommentar

Beispielsvorgehensweise:
- Öffne eine "DOS" Kommandozeile
- Gehe in deinen "Hauptordner" und tippe ein:
- - dir /B>descript.TXT

- Öffne die descript.TXT Textdatei in Notepad2 (zB, oder in einen anderen Texteditor, welcher sowas kann,
oder in einem Tabellenkalkulationsprogramm, oder verwende SED, oder gleich die PowerShell)

Umschließe alle Zeilen (ob Leerzeichen enthalten oder nicht, spielt keine Rolle) mit Anführungszeichen "...".
Wenn du allerdings überhaupt keine Leerzeichen im Dateinamen hast, dann brauchst du diesen Schritt nicht unbedingt zu machen.

Hinter den Dateinamen kommt dann aber ein Leerzeichen als offizielles Trennzeichen, gefolgt von deinem Kommentar:

Hier am Beispiel von Notepad2:
- - Strg+A
- - Alt+M
- - >> Prefix: "
- - >> Append: " DeinKommentar
- - OK
- - Speichere dein Ergebnis als descript.ION



- - -
- - -
- - -
- - -

 
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Can you automate adding descriptions (comments) to files?

Post by *ghisler(Author) »

You can also use menu Files - Change attributes - More attributes - tc-comment
to set the same comment for multiple files.
Author of Total Commander
https://www.ghisler.com
User avatar
Vochomurka
Power Member
Power Member
Posts: 814
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

Re: Can you automate adding descriptions (comments) to files?

Post by *Vochomurka »

PowerPro script with additional features
Single user license #329241
PowerPro scripts for Total Commander
User avatar
Ambaquista
Junior Member
Junior Member
Posts: 60
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

Re: Can you automate adding descriptions (comments) to files?

Post by *Ambaquista »

To Stefan2
Your "little" FAQ is ... GREAT!
Thanks
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Can you automate adding descriptions (comments) to files?

Post by *petermad »

2Andante
Maybe you can just copy the list to the descript.ion file - that depends on the format of your list - can you give an example of a line from your list?
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply