I'm guessing you probably don't use
vim... so maybe this will just serve as incentive to learn it, or maybe a brief tutorial.....
$ vim *
will open all the files;
:!mkdir mine/; mkdir notmine/
will create directories called "mine" and "notmine";
:!mv % mine/
will move the current file to a directory called "mine";
will drop that file from the ones that vim is dealing with and move to the next;
:!mv % notmine/
will move the current file to a directory called "notmine". What's going on with these move commands is
: enters Command-line mode
! starts a shell command
% causes vim to substitute in the name of the current file. If any of the filenames have spaces in them, you'll need to double-quote the
% argument, eg
:!mv "%" mine/.
b, then the up arrow to get the
:bdel command again.
!mv, then the up arrow repeatedly to cycle through your previous
!mv ... commands. You can also just type
:! and then the up arrow, but that will get the
!mkdir... command as well.
In case you hadn't already guessed, the up arrow in vim's "command-line mode" (what you enter by pressing
: in "normal mode") will cause it to go through the previous commands that start with whatever you've already typed there.
Also, on the off chance that you are doing this without any previous experience with vim, I must first commend you for making such a bold move, and then proceed to inform you that if at any point you accidentally hit a key on the keyboard and you start actually typing stuff into the file, or things otherwise work unexpectedly, hit
<ESC> a couple of times, and then
u to Undo any changes you made accidentally. If you go too far back (not really an issue for this example, since you're not actually going to be modifying any files), you hit
<CTRL>-R to Redo stuff you just Undid. The
<ESC> will bring you out of Insert mode or Visual mode, back into Normal mode, which is where all these commands actually work.
Okay.. after that little PSA, back to our regularly scheduled programming.
To make your file processing more efficient, you can set up a couple of macros:
qm:!mv % mine/<CR>:bdel<CR>q
This will actually have the effect of moving the current file and dropping it from vim's "buffer list", so make sure it's one of yours when you set up this macro. Note that
<CR> herein indicates that you hit the ENTER key at that point; don't actually type
qn:!mv % notmine/<CR>:bdel<CR>q
Same deal here.
Then to move a file to the "mine" directory and move on in the buffer list, you do
Or if it's not yours
Actually it might be wiser to map those macros to letters that are further apart on the keyboard than
n.. but that's the basic idea.