UNDO for move operation

Started by ubacher, September 19, 2017, 10:53:00 AM

Previous topic - Next topic

ubacher

I selected files from all over the db. I then used drag and drop to copy these files to a working directory.
But I mistakenly moved the files instead of copying them!

Fortunately it was only 29 files and my file and folder naming scheme allowed me to manually copy them back to their
original location. But what if it had been thousands of files - and no way to easily find their original location?

Thus my request: An UNDO operation for file moves
I make this request because of the ease with which this mistake can happen and the severity of the consequences.


I considered going back to my latest P&G backup - then the files would show up as "missing from disk".
Since there is no easy way to list "missing on disk" files this would not have helped much - even if one would have remembered to
turn automatic indexing off.
Restoring the files from backup would have been the next option but would have lost me changes since the last backup.




Mario

#1
Almost impossible to do.
IMatch does not move the files, Windows does. And there is so much going on behind the curtain, especially in network environments, remote file systems, that I don't bother.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Keeping a list of filenames (including path) of files moved should be all that is needed.
When needed one could write these out to a text file and use a script to move the files back.
(After maybe editing the list first)

Mario

#3
There are a lot of technical challenges involved or I would already have implemented this when I created IMatch 5.

Like, what if the user aborts the move half.-way through. Windows will tell IMatch everything is OK, because aborting the move is a valid action.
What if files are replaced during the move? What if files are renamed during the move, because of name collisions?
...

So far you are the first user ever who has requested this and this means that this is a not-problem for most.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Its complicated and probably not something you want to tackle.. but my Explorer replacement XYplorer has multi-level undo/redo for Move, Copy, Rename Delete and New file operations... 100 user actions are logged and can be undone.

Now - that is an explorer replacement.. IM is a photo management tool... but - since both deal with windows file operations - it might be something to look into down the road.

Mario

Then maybe this tool is the better tool for moving files than a DAM.
Or the author/company of this software concentrates 100% on Windows Explorer-like functionality. For IMatch, this is maybe 0.05% of the feature set. I concentrate on DAM.

I tried it and the Windows functions proved to be unreliable in what they report back to the application.
Of course I could do all this manually, doing all file operations with my own code. Then I would stay in full control and could even implement an undo.
But I'm sure there are many special cases to handle of which I'm not even aware of. From off-line storage to mount points, virtual folders etc. Lots of things to learn and consider. The Windows functions I use take care for all that, from Windows 7 to Windows 10 and the Windows server editions.

Such a change could easily become a project that keeps me occupied for several weeks.

I'd rather concentrate on things which are useful for multiple users.
An Undo for file move operations has been requested exactly once so far. And maybe some "me to" users chime in on this thread.
But that does not mean that I will stop what I'm doing until March to squeeze in replacements for file/folder move/copy/rename operations to match the capabilities of your specialized Windows Explorer replacement.

Find 20 or 30 users who consider a missing Undo for a file move operation in IMatch a problem that needs to be handled and I will sincerely look into it.
Until then, I'd prefer to stick to what we have now and which worked so well for the past four years.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

I am aware that the need to undo a move is a rare operation. But a wrong move with many files can be a catastrophe.

Considering the difficulties maybe the following request would make more sense:
Keep a log of the last n move operations and make it available on demand via a text file.

Maybe an option to log move operations in the log file would be the simplest.

The important information for the user is to know where a file came from and where it went.


Have you ever dropped files unintentionally into the wrong folder and then not known where the files are?
That is probably the situation where such a log would be used most often.

Mario

Did you try Windows Explorer Undo after your wrong move?
IMatch tells Windows to keep undo info if possible.
But of course be re-adding the files to your database you will loose the data that is still linked to versions IMatch knows about.

If you often move files into the wrong folder, maybe using <Ctrl>+<X> in the source folder and then <Ctrl>+<V> in the target folder after carefully considering the folder you are pasting into will reduce the risk or wrong move operations for files.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

Tried: moved a file from one folder to another within IM. (drag and drop)
Windows explorer did not let me undo this (i..e did not know about it)
But.... instead, I saw that it lets me undo the last (manual) delete operation I did within IM!

...of course one could  always only copy and delete instead of move.... and not make any mistakes...

sinus

Quote from: ubacher on September 21, 2017, 08:58:31 AM
...of course one could  always only copy and delete instead of move.... and not make any mistakes...

I made a habit for me over the years, if I take a pic or more and place it in another folder, I hold the mouse and look always at the sign, if there is a + or not. Depends what I want, when I am sure, I leave the mousebutton.  ;D

Because you can do such a mistake in other programs too or in the Explorer.
The same I do, if I delete e.g. the recycle bin, if you delete this, your files are also lost (except you can recover them with special software) or if I do overwrite some filed with a new version.
I believe, we have to be careful here.

Finally at least the moved files are not lost, they are "only" in anther place, where you have to find them.  ;D

I mean, you take a bunch of 500 images to copy instead of move.
At least one name you should find out (you can remember or  look in the "last used-app" or maybe a collection), then you can find at least one image and if you find one you have found the others too, I think.
If you have of coure done so with very different image, they are maybe, depended of the sort-order not together, but you will find it.

It will take some time for you of course, but maybe not that long, if Mario would program somehing to help here.  ;D
Best wishes from Switzerland! :-)
Markus

anmue

Hi,

I think having access to a list of the origin of the moved files in case of an accident, could be a great live saver. Then one can fix the mistake ubacher describes manually. Or write a batch script. Here it does not need a fully fledged functionality.

Maybe Imatch could maintain such a list in the log file or similar?

Just my two cents

Andreas

mastodon

What if IMatch would make a log file about the last operation, if that needed?
Than you can undo it manually. It would be good enough for finding missplaced files.

JohnZeman

FWIW before I move any files I assign them to the flag set collection which I normally keep empty.
Then after the move if I think I put that file in the wrong folder I just go to the flag set collection to see where it is.

Jingo

Hmmm... can't we make an app to do this process which would also maintain a list for an undo?

ubacher

A move selected files App which writes a list of the files and their original location. Better still it can
write a batch file which would move the files a back.

Related/same problem:
I recently copied (I thought) some files via drag and drop to outside of IM.
Depending of where one drops it turns into either a copy or a move. I missed that
and thus accidentally removed the files from the db.
----> To avoid this accident in the future I wrote myself an app to copy selected files to a folder outside of IM.

Jingo

Quote from: ubacher on January 08, 2018, 12:22:50 AM
A move selected files App which writes a list of the files and their original location. Better still it can
write a batch file which would move the files a back.

Yes... will need to think about this but perhaps this is a solution and one that can be expanded upon with further operations as time goes on... will see what I can come up with when I have some time.. LOL - don't know when that might be.. but.. ;-)

rick42

Quote from: mastodon on January 06, 2018, 11:41:18 PM
What if IMatch would make a log file about the last operation, if that needed?
Than you can undo it manually. It would be good enough for finding missplaced files.

I am not sure whether there have been any more steps taken about this topic...

I have accidentally moved folders to unknown places a few times within IMatch, simply because my finger accidentally twitched the mouse button - just as I was moving the mouse.
Again, this morning...

Not something I can plan for ahead of time ;)

A notice of some sort flashed on the screen, and disappeared in an instant. I couldn't see what was moved, or where the folder went. 

Is there a way to find out what folder got moved, at least, so I can look for it?

Thanks!

ubacher

I have written a script for this. It writes a text file (JSON) in the directory the files where moved.
A second script takes this text file and from the info in it moves the files back to where they were.

PROBLEM:
You have to force yourself to always move files via the script - awfully hard to remember.
And absolutely no use if you do the move (via drag/drop etc) accidentally.
That's why it would be useful to have an entry in the imatch log file which shows the file and the directory it was moved into.

rick42

"it would be useful to have an entry in the imatch log file which shows the file and the directory it was moved into."

:)

+1


Mario

Quote from: ubacher on June 20, 2021, 06:09:31 PM
That's why it would be useful to have an entry in the imatch log file which shows the file and the directory it was moved into.

When you write your app, why not log where you move the file?
And when I remember correctly, IMatch writes the fully path to the log file, when the log level is set to high or debug logging.
Not in normal logging, because such information is rarely needed.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

rick42

I discovered that in the Edit menu, Ctrl+z will actually undo a folder move!

It won't show where the folder went, but it does move it back to where it came from.

- It does not also give an option for undoing a file move 
- and the "full logging" and "debug"" log files mention folder and file moves, but do not seem to name them

but for undoing inadvertent folder moves, the edit menu shows whether the "undo move folders" option is available,
and if it is, Ctrl+z works! ;D

Mario

I would not reply on the folder move undo, especially not when you have made other changes since to the database, or the database has been updated by other, background, tasks.
It is implemented and works in general. But Windows has the tendency to mess things up rarely, which then breaks the links between database and files on disk. Or maybe just the virus checker kicks in and blocking some operations of IMatch. Or ...

I recommend to thing twice, then move the folder.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

I considered logging to the Imatch log file. But it's the same problem: I have to remember
to move only via the app.

I tried full debug logging: there is no entry for a CTRL-X CTRL-V move of a file, nor of a pick and drop move - which, as you pointed out -
is done by Windows. But Imatch must know when files are removed/added to a folder. Detecting that a remove followed by a drop of many
files is a MOVE is probably the challenge.

rick42

Quote from: Mario on June 20, 2021, 08:04:45 PM
I would not reply on the folder move undo, especially not when you have made other changes since to the database, or the database has been updated by other, background, tasks.
It is implemented and works in general. But Windows has the tendency to mess things up rarely, which then breaks the links between database and files on disk. Or maybe just the virus checker kicks in and blocking some operations of IMatch. Or ...

I recommend to thing twice, then move the folder.

ok, understood -

In that case, if possible, "it would be useful to have an entry in the imatch log file which shows the file (or folder) and the directory it was moved into", or some other alternative for seeing this information (I do not see it in the "full logging" file), especially for when the user does the move inadvertently, and then can't even see what it was they did :-[

Tveloso

Just wanted to throw out an idea...

IMatch already records, in a file's History, that a Move operation has taken place.  I'm not sure if this is only for the Move Step of the Renamer, or if any move operation will add that entry...but I wonder if the Source and Target paths could be stored along with the entry?...

This of course will not help if we don't know what was moved, but I wonder if another view into the History (one not dependent on having selected a file first), could then present a log of the n most recent operations (or within some prior TimeWindow), in descending chronological order?...
--Tony

Mario

#25
The file history records and displays (if you enable the details view, right-click into the Panel or use the menu) the source and target of move operations:



Top row: New location, bottom row: original location.

When you rename a file, the previous file name is added to the history for the "Renamed" entry.
And also into the "PreservedFileName" XMP tag, when this was the first rename operation.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Tveloso

Awesome!

There have been so many times when I thought "it would be great if IMatch could do such-and-such"...and upon consulting the Help, I found that it already could (and usually much better than what I was thinking)!

So, for this case, I wonder if the move entries in the History could be accessible outside of a file selection?...(via an App perhaps?)...
--Tony

Mario

v1/files endpoint. Request the history field.

Tip: Select a file and then run the File Data app to see how the history is returned as part of the v1/files endpoint result.



"text" contains the original file name + path.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

So we have a solution to the question : From where did I move this file.
(Small fly in the ointment: the COPY option in the history panel only copies the title like this:
21/06/2021 09:29:20 Moved ubach
)
This leaves the problem of:

which file did I move accidentally to where?

A Moved out of folder History?


Mario

#29
Did the Undo not work for you?
Why do you want to copy this into the clipboard? You can see the original file location in the History panel and just move the file back?
IMatch uses the "Copy" function of the report control (3rd party) to copy the selected record(s) into the clipboard. It does not copy the "details".
Doing this would require me to implement this manually, and I really don't see the demand. You can use the File Info app as shown above if you really need to copy that information into the clipboard.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook