MetaMove is written in Python3 and targets at easing batch renaming operations in step with file meta knowledge.
MetaMove abuses eval
blended with f-strings
. It be some form of wrapper, that handles file operations and requires a Python3 format string generate recent file names.
Featured Content Ads
add advertising herepython3 metamove.py --form f --dry --title "take a look at/" "test1/{title}-{int(stat.st_mtime)}.{ext}"
utilization: metamove.py [-h] [-R] [--type {f,d}] [--name NAME] [--dry] [--regex REGEX] sample
positional arguments:
sample destination directory with Python f-string for renaming operations, e.g. "test1/{title}-{int(stat.st_mtime)}.{ext}"
optional arguments:
-h, --reduction inform this reduction message and exit
-R, --recursive Activating this switch will traverse recursively by subdirectories.
--form {f,d} "f" for file or "d" for directory, defaults to both
--title NAME glob that will match on recordsdata, an equivalent to "salvage -title *.txt"
--dry develop no longer truly develop the rest however showing the tip outcome
--regex REGEX regex to extract filename parts, would possibly possibly also impartial also be accessed within the 'sample' using the 'regex' array
Curly braces
That that you just would possibly consume any expression that Python3 allows internal f-string curly braces
A number of examples to receive you started:
title
— Filename with out extensionext
— File extension with out main dotmime
— File mime form- stat knowledge take care of
stat.st_atime
— Final receive entry to datestat.st_mtime
— Final modification datestat.st_ctime
— Final inode modification date- and others: https://pathlib.readthedocs.io/en/0.5/#st-attrs
- IDv3 tags take care of
mp3.ticket.artist
— IDv3 artist ticketmp3.ticket.title
— IDv3 title ticketmp3.ticket.album
— IDv3 album ticket- and a whole lot of more: https://github.com/nicfit/eyeD3
- file title parts if
--regex
is receive 22 situation:regex[0]
— first matchregex[1]
— 2d match- and a whole lot of more depending for your regex and different of fits
Examples
Dry dash all recordsdata from folder take a look at
to test1
and rename them accordingly.
Featured Content Ads
add advertising herepython3 metamove.py --form f --dry --title "take a look at/" "test1/{title}-{int(stat.st_mtime)}.{ext}"
End result:
take a look at
to test1
, form them by mp3.ticket.artist
into folders and consume mp3.ticket.title
as filename.
python3 metamove.py --form f --dry --title "/*.mp3" "test1/{mp3.ticket.artist}/{mp3.ticket.title}.{ext}"
End result:
Featured Content Ads
add advertising here./metamove.py --form f --dry --title "/*.mp3" "test1/{mp3.ticket.artist}/{mp3.ticket.title}.{ext}"
take a look at/file_example_MP3_1MG.mp3 -> test1/Kevin MacLeod/Impact Moderato.mp3
Dry dash recordsdata from take a look at
to test1
and strip away the non-alphabetic characters from the filename.
python3 metamove.py --form f --dry --title "take a look at/" --regex "[A-Za-z]*" "test1/{regex[0]}.{ext}"
End result: