Automatically duplicate Filename in the comments column

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Automatically duplicate Filename in the comments column

Post by Mr.Pleasant »

Anyone got a brilliant idea for this?
I'm renaming a large amount of files. They need to be renamed according to another file naming system. But I don't want to lose the connection with their old name altogether. So I'm thinking of putting their old file (base) name in the comments column (you know, the comment you can change with the Alt-z shortcut).
Now I'm looking for a way to do this automatically (the renaming itself is tiring enough...). So, if you know any way of clever X2 commands, Dos, or anything else that will achieve this: please help me out!
Thanks!
User avatar
nikos
Site Admin
Site Admin
Posts: 15519
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

:shrug:
the only thing i can think of is to write a WSH (script) and add comments programmatically through some shell object
Cosmo
Gold Member
Gold Member
Posts: 465
Joined: 2007 Apr 17, 11:09

Post by Cosmo »

Sounds that there will be a tremendous amount of labor. And what for? It sounds, as if you want get the option to get back to the old names. And then the labor has to be done a second time.

Perhaps this is feasible: Say the files are named oldname.ext
By mass-renaming like $#.$N you give them a temporary new name and override the number with the needed new name. This would preserve oldname in the middle. Perhaps the idea helps.
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

Thanks, Nikos and Cosmo!
The problem is that I have a lot of image files which are all linked to a big DTP document by means of their file name. Now, these image files have been updated. Actually, the new files contain translations into another language (I'm doing a localisation job). These new set of images, as I wrote, have all new filenames. To link them to the DTP document, I have to rename them according to the names of the old images.
But for the sake of checking, and, who knows, 're-updating' images or going back indeed, I'd like to have some system which could give me an easy clue of the 'naming history'.
Your suggestion, Cosmo, might work, in a copied environment, and could then function as some sort of conversion table. But it is not exactly what I'm after.
Maybe I'll try to work out about Nikos' suggestion, and see if VBscript, or other WSH, could help me there.
User avatar
nikos
Site Admin
Site Admin
Posts: 15519
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

if i manage to figure this out in time i'll devote tomorrow's blog to this topic, as a general introduction to WSH
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

i'll devote tomorrow's blog
Much appreciated! I've been looking into this more and more lately, and hoping to add it to my box of tools.

As for the initial issue, I can't find much in the usual scripting languages that applies to editing ADS streams.
I went back to good old 'Script Wizard'. This code:

Code: Select all

echo $N > "$F":x2_AFScomment
followed by 'Execute (DOS)' would do the trick, except that.... this adds the filename to the Comments column as ANSI text, whereas it is read by X2 as unicode, once it is displayed in the column. Funny, but not useful to see the old filename converted into a set of chinese characters.... :roll:
User avatar
nikos
Site Admin
Site Admin
Posts: 15519
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

nice one! but the stream "x2_AFScomment" is something that x2 uses only if all else fails so it won't be "portable" to other file managers
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

so it won't be "portable"
Thanks. It would be acceptable nonetheless, but this difference in encoding is the real showstopper... But it is good to know how this stream '"x2_AFScomment" works anyway!
User avatar
nikos
Site Admin
Site Admin
Posts: 15519
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

i found this WSH extension object that should read and write file comments. I won't blog about it since nobody will understand it as an introductory article!
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

Well, I hope it isn't too advanced for me either.... But surely, I will have a look at this and see if I can use it to my benefit. Thanks for pointing me in the direction, Nikos!
Post Reply