rename_files_by_age
% function rename_files_by_age()
%
% function to automatically rename pictures and videos to start with age
% from specified date. Written for baby pictures.
% Example: Changes name from 'foo' to '##Y##M##D_foo'
% ie - 'foo.jpg' to '01Y03M10D_foo.jpg' if pic taken 1 year, 3 months, 10
% days after birth
%
% I tried to keep it simple, so I just copy it into a folder with files I
% want to rename and then run it
% I put all video files in a subfolder called 'videos'
% change variable folder_videos below if you do something different
%
% my files came from many different sources
% (iPhone, android phone, multiple cameras, ipcamera)
% and they don't all have the same info, so here's what I came up with
% for *.jpg pictures:
% - I try exifread to get DateTimeOriginal
% - if that doesn't work, I use imfinfo to get FileModDate
% for videos:
% 1. *.3gp files from android phone
% -named as VID_YYYYMMDD_HHMMSS.3gp
% -just use the date from the original filename
% 2. *.mp4 files from android phone
% -named as YYYYMMDD_HHMMSS.mp4
% -I use picasa, which doesn't like mp4 files, so I rename as .mov
% -then just use the date from the original filename
% 3. *.avi files from digital camera
% - not ideal b/c only have access to last change date, not date created...
% would be a problem if only upload videos from camera rarely
% 4. *.mov files from iphone
% - not ideal b/c only have access to last change date, not date created...
% would be a problem if only upload videos from iphone rarely
% 5. *.wmv files from webcam
% - not ideal b/c only have access to last change date, not date created...
%
% v1 - Nathan Tomlin. Feb 12, 2012. nathan.a.tomlin@gmail.com
% v2 - Feb 28, 2012. Fixed error in .jpg renaming and added .wmv check
% v3 - Aug 11, 2013. Fixed error in age rename and added .mp4 check
引用
Nathan Tomlin (2024). rename_files_by_age (https://www.mathworks.com/matlabcentral/fileexchange/35052-rename_files_by_age), MATLAB Central File Exchange. 取得済み .
MATLAB リリースの互換性
プラットフォームの互換性
Windows macOS Linuxカテゴリ
- Gaming > Just for fun >
- MATLAB > Programming > Files and Folders > File Operations >
タグ
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!