This project has moved and is read-only. For the latest updates, please go here.

rewrite workaround

Apr 11, 2016 at 5:01 PM
Edited Apr 11, 2016 at 5:02 PM
I just discovered this project and gave it a try, I wanted to ask a couple of questions.

I started by enabling my .dwg and .dxf file for metadata. It looks like Autocad behaves like some file editors so that when you open the file and save it, you lose the metadata information. Is there any workaround or solution for this kind of problem ?

Also, I wanted to know if,like in our case, there´s a SVN repository, metadata will be shared among all the people checking out from that repository.

Last, I would like to know how to add metadata to a folder.

Thanks

Regards

José
Apr 11, 2016 at 8:14 PM
Hi José

There is no general workaround: if the editor does not preserve the alternate stream on update, the metadata is inevitably destroyed. However, it is possible to preserve it by exporting it to XML, and then re-importing it after the update. As I provide command line support for these operations, import and export can be performed using a batch file or other scripting language external to the tool, or invoked from within the tool itself, if the tool provides a sufficiently powerful macro language.

Similarly, whether the metadata is preserved in an SVN repository depends on how the repository implements file copy i.e. whether its file copy preserves the alternate stream or not, so for any particular implementation it is a matter of try it and see. Again, there is a possible workaround in cases where the alternate stream is not preserved, exporting the metadata to an XML file automatically during check-in, storing the XML file in the repository, and reapplying it automatically during checkout..

Finally, I know of no mechanism for adding metadata to folders in Explorer. NTFS does support writing metadata to an alternate stream associated with a folder, but the stumbling block has always been that there is no extensibility point that I know of in Explorer for adding a User Experience on top of it. If I ever discover or hear about such a mechanism, I will cheerfully add it to the implementation, as folder metadata is something I would dearly like to have myself.

I’m sorry, I don’t feel that any of these answers are particularly positive, but they do reflect my best current understanding.

Dijji
Apr 11, 2016 at 9:59 PM
Hi Dijji, and thanks for your fast answer.

First of all I must say I find your work very interesting and would be willing to use it on my daily work provided I could overcome some of the drawbacks. Mostly I work with binary files, usually either Autocad files or 3d design software like Solidworks. I made a couple of tries and both Autocad and SW showed the same result, meaning when you save the file after modifying it, the metadata is lost. Actually I would be happy to be able to modify just one of the properties: "Comments". This way I could put a a comment on every file and would not need to open it to know it´s content.

We have been using SVN for at least the last 5 or 6 years now. SVN has it´s own internal mechanism to add metadata, in SVN´s terms they are called "properties". You can use both predefined properties as well as your own defined properties. If you want to commit a file to the repo, you need to save if first (modify the file). However when you save it, windows metadata are recreated (I assume) so that all the metadata which is not usually written from within the software you are using is lost. I guess that´s where the "sufficiently powerful macro language" comes in. What I did now was : I added a new property fo a file (without touching the file itself). If you do that, you can make a commit operation. I comitted to the repo and checked the file out in a different machine. The result was: I could not see the modified Windows metadata on the other machine. My idea is that probably SVN knows the file has not changed, so that is why it only commited the file´s properties, not the file itself, so I am really not sure what is going on.

The problem with SVN´s properties is than they can not be added to Windows explorer bar, so if you want to know which are the file´s properties then you must right-click on the file and open the properties manager, which is not a good way to quickly identify files you are looking for. I think what is needed is to add.

My question is: would it be possible to add a new shortcut to Windows standard "Save as" dialog box, this way you could implement an application which saves metadata, saves the file, and then adds the saved metadata to the file. I am not a computer ileterate but have not done it before so I would not know how to do it. I am thinking of something like this http://www.howtogeek.com/107965/how-to-add-any-application-shortcut-to-windows-explorers-context-menu/.

Thanks for your help.

Regards

José
Apr 12, 2016 at 7:16 PM
Hi José

The link you give is about configuring additional items in the Explorer context menu using the registry. It works because Explorer looks for these registry entries and uses them when building context menus.

The File Save dialog, although it is a standard dialog, is controlled by the editing application, e.g. Autocad, and so, if there were a way to extend the dialog, it would be by configuring Autocad.

As you point out, Subversion holds file and folder properties in a store separate from the file itself. So if you make a versioned property change, you can commit that without any changes to the file itself. Then, pulling the update to another machine should update the property, but not the file.

The ideal solution would be for Subversion properties to be displayable in Explorer. It would be possible to do this by writing a property handler similar to that in File Meta, but using Subversion as the backing property store. Also, when you edited a property in Explorer it would make a versioned change to an underlying Subversion property. However, this would be a new project, beyond the current scope of File Meta.

Short of that, it might be possible to come up with a workaround that copies properties from Subversion to NTFS (where File Meta can access them), and from NTFS to Subversion, at appropriate times. One approach would be to use batch files that read and wrote the appropriate properties, and invoke them manually from context menus. Another would be to try and find a way of invoking the same operations automatically before and after Subversion checkin and checkout (do you use one of the Subversion front ends to perform these functions?). I’m not quite convinced, however, that such an approach can be made reliable enough to be usable in production.

Dijji
Apr 12, 2016 at 9:25 PM
Edited Apr 12, 2016 at 9:27 PM
Hi Dijji, thanks for the feedback.

We use TortoiseSVN as a GUI interface with Subversion. I am familiar with how you can perform some of the operations from a dos screen or linux terminal, but to be quite honest I would have to check the right syntax before, it´s been a while since I have not done anything without TortoiseSVN.

If you only install the SVN client, you can do all the operations you need from the command line. However, if you install TortoiseSVN, the context menu changes (for all Windows applications as far as I know) so than when you right click on a file you can perform some other operations, for example an SVN commit. Actually what we do is: open the file, work with it, Save it and then perform the commit from within the application itself using "Save as - Right Click - Svn Commit". I was thinking that maybe adding another step before the "Save" operation could allow you to perform the saving of the metadata on a temporary file. Have a look https://tortoisesvn.net/ExplorerIntegration.html#contextmenus if you would like to see how the context menu for Tortoise looks.

However I find your last paragrah very interesting and maybe something we could explore, let me explain:

In SVN, there´s something called "Repository hooks" which are meant to be executed before and after you do either an update or commit. Again, I should read again because I know they are there but never used them.

Basically the idea (if it works) would be to use one of Subversion properties, to be completed through the standard SVN mechanism, and write a hook script to make SVN copy one (or more) of it´s properties to one of Windows metadata after each commit or update. There will be a time when you are working on something that the info will be missing in Windows (after you perform a local save) but once you commit or update the file it will be back there, provided someone has written the needed property in SVN before, otherwise it would be blank. I think this would be easier (and stronger) than telling people they should execute a batch file before saving the file, or trying to mess with Autocad Save mechanism, which I imagine is not possible.

One thing SVN is missing (at least as far as I know) is the ability to find a file based on it´s properties, so for example in my case if I defined a property called "comment" in SVN, and used it to rewrite Windows "comment" metadata, I would not be able to find a specific file (or files) that match a particular property. As far as Windows search is concerned ( I am using Windows 7), standard search is based on the file name, but you can also search by Class, Modify Date and Type if you click on the search Icon on the right top of the screen (I am translating from my Spanish version so maybe some of the terms used are not right). Is it possible to perform a search based on some of the metadata also ?

I will look into the hooks stuff and let you know if it would be possible to do what you are proposing using a hook.

Regards

José
Apr 13, 2016 at 9:50 AM
Hi José

if the folder containing your files is currently being indexed (see Indexing Options in the Control Panel), then your files are already being indexed automatically using metadata such as Tags and Comments. You can therefore find files using simple text searches. Of course, you can also use Explorer advanced searches to look only for comments e.g. comments:=aaa in the search box will look for files with the comment aaa, or comments:~=aaa will look for files with aaa anywhere in the comment (see http://windows.microsoft.com/en-us/windows7/Advanced-tips-for-searching-in-Windows).

To access Windows metadata properties from scripts, the thing you need is DSOFile. This is a Microsoft download that lets you read and write properties. You can get it from https://www.microsoft.com/en-us/download/details.aspx?id=8422, and it is described here: https://technet.microsoft.com/en-us/library/ee692828.aspx#EFAA

Dijji