Is there a way to write a script that reverses tha last file move action? I am using GraphicConverter and it allows me to move files files to preset folders as I am watching the slideshow. Sometimes I make a mistake and file a photo into a rejects folder. There is no undo command so I have to go to the finder and find the last file moved and manually move it back to the main folder. Could this be done via applescript? I guess it could get the folder path from GraphicConverter or it could find the files by searching the whole hard drive for a file with .jpg extension that has been moved in the last 2 minutes. Switching to the Finder and using the undo command does not work either because the Finder only registers move actions when done in the Finder.
Any suggestions are very much appreciated.
Off-hand, I can’t see any practical way of doing this.
For a start your idea of “searching the whole hard drive for a file with .jpg extension that has been moved in the last 2 minutes” will not work since there is no record of file moves. File dates only get updated when the file is changed, not when it’s moved to a different folder. You could find folders that have changed recently (the folder modification date is updated when a file it put in it), but even then you couldn’t easily tell which file within the folder was the most recent.
The only way it could work would be for the script to take a snapshot of the entire filesystem and compare it with the last snapshot, but even then it has no way of knowing which change was the most recent.
One idea that occurs to me is to write a script as a folder action scriipt that simply saves the name of the last file that was placed in the folder, and the time it arrived, as properties of the script. Give it an “on run” handler that just displays the information. Make a copy of the script for every folder that you are likely to move files to, especially the reject folder.
You could then have a master “find last moved” script that accesses each of the folder action scripts using , e.g., “set s to load script ”, and reads the properties of the scripts (the info about last file saved into the folders). It could simply display all the info, or compare the date/times and report the most recent one.
I can’t think of any way, though, to detect where the file came from and to move it back. The only way I can think of would be to query Graphic Converter about what folder it is currently displaying, if that is possible, and to move the file back there.