Undo/Redo

The Properties Dialog | Toolbar | Multiple Renaming or Duplication

## Undoing and Redoing an Alteration

You can access this from the Edit menu (or the Context menu) or use the shortcuts Ctrl-Z and Ctrl-R respectively; but the most convenient way is to use the pair of curved arrows on the main toolbar (which will be disabled unless there are alterations available).
In what follows I'll mostly refer to Undoing things, but Redoing is exactly the same.
There are two ways to use these buttons:

- Click the main part of the button. The next available alteration will be undone. More clicks, more undos. This is also what you get from a menu or a shortcut.
- Use the "dropdown" arrow to the right of the main button. A menu-like window will appear, that lists the available items to undo. Select one and all items up to and including it will be Undone. If there are too many to show on one page (15 by default but you can change this in Options > Configure 4Pane > Misc) there will be a 'More' entry at the bottom to show the next page.
  Each item will give you some idea what you'll be Undoing e.g. Undo Delete or Undo Rename (17 items).

As you just read, actions are clustered: if you rename 17 items, you get to Undo and Redo these all at once; if you delete a directory containing hundreds of files, it appears as just one deletion. This is normally what you'd want (you really wouldn't want to have to undo hundreds of deletions one by one) but it does mean that if you decide you only wanted to rename 16 of these files, you have to Undo them all, select the correct files and rename again.
You should be able to go up and down the list, Undoing and Redoing the items, as often as you wish. However there are four situations where Redoing will no longer be possible:

- If you reach the maximum number of allowed Undos. After this, when you add an extra Undo, the oldest one on the list is silently discarded.
  By default that maximum number is 10000, which should be enough for most people. However it isn't quite as good as it seems: Deleting 17 selected files uses up 17 Undo items (as data for each has to be stored). However deleting a directory with all its contents counts only as one. You can change the maximum number of Undos in Options > Configure 4Pane > Misc, but the change won't take effect until 4Pane is restarted.
- If you Undo several alterations, and then do something else, you can't then Redo those several alterations. This is intentional: there would be no guarantee that those Redos were still possible and safe.
- For similar reasons, if you empty the 'Deleted Can' (Options > Permanently delete 'Deleted' files) all Undo/Redos are lost. A warning message is shown first.
- If something is done outside 4Pane. Suppose you rename a file, and then a different application deletes it. You clearly cannot then Undo the rename. Not only that, but if this happens 4Pane decides it can't trust any upstream Redo, and discards them.

The moral: You can't absolutely rely on the Undo/Redo system. It will work 99.9% of the time, but if you contemplate doing something that will hazard important files, I strongly suggest backing them up first. (Perhaps this would be a good time to re-read the licence and disclaimer.)
Most things that you do to your filesystem with 4Pane can be Undone and Redone. However there are some that can't. The main exceptions are:

- Extracting an archive (Archive > Extract Archive or Compressed Files)
- Anything that you do in the Terminal Emulator or Command-line, or with User-defined tools.
- Permanently Delete, which intentionally bypasses the Undo/Redo system, thus trading safety for speed.