I've written a small Perl script renaming or copying files acording to their the modification time. This may be useful for example to rename photos read from a digital camera, usualy named like 001.IMG to something like wedding-2003-03-04-09:41:00.img, where 2003-03-04-09:41:00 is usually the date/time when the photo was taken (if your camera sets the file dates acordingly).
Another option is just to rename a set of files by adding a sequence number 0, 1, 2, ... to a basename.
Download the actual version (1.4 of 2007/05/21) of the script.
All my tools are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The programs are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
You should have received a copy of the GNU General Public License along with those programs; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you find this software useful, please send me a postcard from the place
where you are living:
Dr. Jürgen Vollmer
Am Rennbuckel 21
D-76185 Karlsruhe, Germany
NAME mv-date - a script to rename or copy files accroding to their modifica- tion time SYNOPSIS perl mv-date [<options>]* file ... OPTIONS -A : use the atime of the files -M : use the mtime of the files (default) -C : use the ctime of the files -N : just renumber the files, ignore the date/time, start with 0 -N nr : just renumber the files, start with nr -D nr : if -N is given, use nr digit (with leading zeros), default 4 -c : copy the files, atime amd mtime are preserved -m : move the files (default) -n : do not perform copy/move, show only the resulting file names (note: -suffix is not added, since the new files are not created. -d dir : destination directory, default the directory as given by the filename. If the directory does not exists, it is created. -o : overwrite an exisiting file, default: add a suffix -p : prefix -h : help -v : verbose DESCRIPTION Renames (or copies) the files given as arguments. Compute the modifica- tion time (any other time see options) and renames the files as: <path>/<prefix->YYYY-MM-DD-HH:MM:SS[-<suffix>].<ext> where YYYY-MM-DD-HH:MM:SS is the selected time of the file and path may be specified by the -d option. If there is already a file with that name append a suffix: 1, 2,... <ext> is replaced by its lowercase EXAMPLE assume you want to rename the following files with the modification dates 001.IMG Mar 4 10:40 002.IMG Mar 4 10:41 003.IMG Mar 4 10:41 the command mv-date -p foo *.IMG will produce the following files: foo-2003-03-04-09:40:00.img foo-2003-03-04-09:41:00.img foo-2003-03-04-09:41:00-1.img the command mv-date -N 1 -p *.IMG will produce the following files: foo-0001.img foo-0002.img foo-0003.img AUTHOR Dr. Juergen Vollmer <email@example.com> If you find this software useful, I would be glad to receive a postcard from you, showing the place where you're living. HOMEPAGE http://www.informatik-vollmer.de/software/mv-date.html COPYRIGHT Copyright (C) 2003 Dr. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe, Germany. LICENSE This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA VERSION 1.4 2007/05/21
Revision 1.5 2007/05/21 16:36:55 vollmer added optional number argument to -N added -D nr command line option Revision 1.4 2007/05/09 20:41:16 vollmer added -N Revision 1.3 2003/08/28 16:28:26 vollmer fixed check for no arguments Revision 1.1 2003/08/12 09:51:38 vollmer Initial revision© Copyright 2005 Dr. Jürgen Vollmer (www.informatik-vollmer.de)