NAME

move-year - Move files to directories according to a date in their filename

SYNOPSIS

move-year --create foo-2025.pdf /home/user/documents/
# creates /home/user/documents/2025
# Moves foo-2025.pdf to /home/user/documents/2025/foo-2025.pdf

move-year --create --directory-style=sprintf foo-2025.pdf "/home/user/documents/documents %y/"
# creates /home/user/documents/documents 2025/
# Moves foo-2025.pdf to /home/user/documents/documents 2025/foo-2025.pdf

OPTIONS

--dry-run, -n

Only output actions, do not perform them. Implies --verbose.

--verbose

Output the actions.

--force, -f

Overwrite files if they already exist.

--i, -i

Don't overwrite files if they already exist.

--strict

Be strict in the detection. When a file fails to detect properly, stop the program.

--create

Create directories if they don't exist.

--directory-style

Elements of the intermediate directory to be created. Defaults to y.

Use --directory-style=sprintf to specify your own template. %y, %m and %d will be replaced by their respective values in the target directory name.

--part-separator

Separator for the elements of the intermediate directory. Defaults to -.

--date-type, t

Type of the date to find. May be a combination of y, m, x, d. Shorthands exist as the options --ymd, --dmy. x stands for the month name.

ymd
dmy
ym
my
y
--date-regex, -d

Regular expression to extract a date. This should be a capturing regular expression that captures into named groups year, month, monthname or day.

Most likely you want to use a premade one instead.

--date-regex-order, -o

Order of year, month and day in your filename strings if your custom regular expression does not use named captures.

Default is ymd.

ENVIRONMENT VARIABLES

MOVE_YEAR_CREATE

Set the <--create> option from the environment

MOVE_YEAR_TARGET

Set the target directory