Can you automate adding descriptions (comments) to files?

English support forum

Moderators: Stefan2, white, sheep, Hacker

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

Can you automate adding descriptions (comments) to files?

Post by *Andante » 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....)

User avatar
Stefan2
Power Member
Power Member
Posts: 2433
Joined: 2007-09-13, 22:20 UTC
Location: Europa

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

Post by *Stefan2 » 2019-05-09, 07:42 UTC

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


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




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
- "SHOW menu > Comments" to get a one column for to see all comments
- 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

- - -

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 >> 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: 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
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.

- - -

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
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

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


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

 

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

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

Post by *ghisler(Author) » 2019-05-09, 10:18 UTC

You can also use menu Files - Change attributes - More attributes - tc-comment
to set the same comment for multiple files.
Author of Total Commander
http://www.ghisler.com

User avatar
Vochomurka
Power Member
Power Member
Posts: 782
Joined: 2005-09-14, 22:19 UTC
Location: Russia
Contact:

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

Post by *Vochomurka » 2019-05-09, 20:50 UTC

PowerPro script with additional features
Single user license #329241
PowerPro scripts for Total Commander

User avatar
Ambaquista
Junior Member
Junior Member
Posts: 48
Joined: 2005-05-27, 11:11 UTC
Location: Luanda, Angola

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

Post by *Ambaquista » 2019-05-10, 22:09 UTC

To Stefan2
Your "little" FAQ is ... GREAT!
Thanks

User avatar
petermad
Power Member
Power Member
Posts: 8341
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

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

Post by *petermad » 2019-05-10, 22:41 UTC

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 9.22a 32+64bit on Win XP 32bit, Win 7, 8.1 & 10 64bit, 'Everything' 1.4.1.935 (x64) and TC 3.0b3 on Android 6.0
Get: Extended Total Commander Menus | PHSM-Calendar

Post Reply