I'm looking for two Linux shell scripts, to maintain duplicated media/binary files (audio/video/program) on a Synology NAS.
For making a file compare between two directories, and create links in case of duplicates:
- Compare files between two locations (A and B), based on filename/date and file content.
- Files in location A can be in various directories, and are considered original files.
- Files in location B are in a directory (with possible subdirectories) and could be a copy of the file in location A.
- Files in location B could have a different name then similar files (based on content) in location A.
- In case the script finds a duplicate between B and A, it should:
- 1) Create a link in the directory of location B to the file in location A
- 2) The link could be either softlink or hardlink (configurable with parameter)
- 3) The link name will be similar to the filename in location A, though could have a prefix in the name (configurable with parameter, eg. link_filename)
- 4) The link should have the same date/time as the file being linked to in location A
- 5) After creating the link, the (duplicate) file in location B should be moved to a subdirectory within location B (eg. old)
For listing an overview of all files in specific directory, with following options:
1) List all files within a directory (incl. subdirectories)
2) List all non-symlink files within a directory (incl. subdirectories)
3) List all symlink files within a directory (incl. subdirectories), include type of link (softlink/hardlink) and link location
4) Create CSV export of the listing
The listing should contain: full directory name, filename, owner, size, date, type (file, softlink, hardlink) and link location.
NB. The scripts should be created and tested on system of freelancer/developer, once done testing will be discussed with and performed by requester on the NAS.