Skip to content

vitaly-s/robocopy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 

Repository files navigation

logo

RoboCopy

This package will help organize your collection of photos and videos into a custom folder structure using rules based on EXIF information.

screen shot

Note for DSM 7

To use this package on DSM 7, you need to set the permissions for the shared folders.

Follow instructions below to set permissions

Step 1: Go to Control Panel > Shared Folder.

Step 2: Select a folder and click Edit > Permissions.

Step 3: Select Internal System User from the drop-down menu.

Step 4: Set Read/Write access for the RoboCopy user.

Step 5: Repeat steps 2-4 for each shared folder you want to use.

How to install

Step 1: Install standard PERL package

Step 2: Download the latest .spk from here

Step 3: Open Package Center in DSM and select the Manual Install option.

Step 4: Click Yes when warned about using a package from an unknown publisher.

Step 5: Complete the wizard.

Step 6: Use the RoboCopy app icon in the main menu to access the RoboCopy UI where you can manage your setup.

Rules

Rules specify what actions need to be performed on files.

Rule field Meaning
Priority Rule execution order.
Description Rule description.
Extention File extension for applying this rule.
Action How to process a file: move or copy.
Destination folder Shared destination folder.
Destination dir Destination path. (Here you can use value substitution)
Destination file The name of the destination file. If empty, the file name will not change. (Here you can use value substitution)

Values for substitution

Values for substitution based on file metadata, they must be indicated by the mustaches (Ex. {title}). Value name is case sensitive.

The Phil Harvey's ExifTool library is used to obtain file metadata.

NameMeaningExample
Date time file creation
hHour (12-hour clock) as a decimal number.7
hhHour (12-hour clock) as a zero-padded decimal number.07
HHour (24-hour clock) as a decimal number7
HHHour (24-hour clock) as a zero-padded decimal number.07
mMinute as a decimal number.6
mmMinute as a zero-padded decimal number.06
sSecond as a decimal number.5
ssSecond as a zero-padded decimal number.05
ttLocale's equivalent of either AM or PMAM
dDay of the month as a decimal number.2
ddDay of the month as a zero-padded decimal number.02
dddWeekday as locale's abbreviated name.Mon
ddddWeekday as locale's full name.Monday
MMonth as a decimal number.9
MMMonth as a zero-padded decimal number.09
MMMMonth as locale's abbreviated name.Sep
MMMMMonth as locale's full name.September
yYear without century as a decimal number.1
yyYear without century as a zero-padded decimal number.01
yyyyYear with century as a decimal number.2001
File name
file_extFile extension
file_dirPath to file (without start dir)
file_nameFile name
Location
countryCountry name where was made photoUnited States of America
stateState name where was made photoMassachusetts
cityCity name where was made photoQuincy
Other
titleTitle of composition
albumAlbum name
artistArtist name
camera_makeCamera maker name
camera_modelCamera name

Using fallback folders

There are times when the EXIF needed to correctly name a folder doesn't exist on a photo. I made fallback folders (thanks Elodie for idea) to help you deal with situations such as this. Here's how it works.

You can specify a series of folder names by taking them in parentheses and separating them with '|'. That's a pipe, not an 'L'. Let's look at an example.

/{yyyy}/({album}-{title}|{city}|Other)

What this asks me to do is to name the last folder the same as the "album"-"title" I find in EXIF. If I don't find an album or title in EXIF then I should use the city. If there's no GPS in the EXIf or I cannot detect it then I should name the last folder "Other".

Location detection

I use Nominatim to help me organize your photos by location.

Geolocation information is not cached between sessions. But for query optimization I use the following algorithm:

  1. I check that the point belongs to any city that I requested earlier (CITY_CACHE). If successful, I return the address of the city.
  2. I check that the point is near (less than the threshold) with the points that I requested earlier (POINT_CACHE). If successful, I return the address of the point.
  3. I request data from the server.
  4. I try to get a polygon that sets the boundaries of the city. If successful, then I remember it in CITY_CACHE.
  5. If step 4 is failed, then I remember the point in POINT_CACHE.

Language of returned information and threshold value You can change in settings.

Notes

Requirements

  • DSM 4.2 and above
  • PERL

Tested on

  • software: DSM 4.2, DSM 4.3, DSM 6.1, DSM 6.2, 7.0.1
  • hardware: DS209, DS218+

Build

Require linux machine with Perl (I use my NAS).

Download sources and exec make.sh

$ sh ./make.sh