The simplest downloads folder organizer Linux service.
Go to file
altf_four 2f1ea37945
Update README.md for v1.3.0
2020-05-02 12:09:51 +03:00
.github/workflows Fix build.yml 2020-04-25 09:27:08 +03:00
.vscode Add all() implementation 2020-05-02 11:54:45 +03:00
scripts Fix rpm postinst 2020-04-28 09:54:48 +03:00
src Add all() implementation 2020-05-02 11:54:45 +03:00
.clang-format Basic Infrastructure 2020-04-17 20:08:54 +03:00
.gitignore Add build directory exceptions. 2020-04-17 20:48:47 +03:00
CMakeLists.txt Bump version to 1.3.0 2020-05-02 11:56:10 +03:00
Dockerfile Re-arrange project structure 2020-04-20 16:23:20 +03:00
LICENSE Initial commit 2020-04-17 12:52:12 +03:00
README.md Update README.md for v1.3.0 2020-05-02 12:09:51 +03:00
build.sh Add codecov support 2020-04-18 10:58:07 +03:00
buildArtifacts.sh Fix buildDocker exit codes 2020-04-18 10:10:27 +03:00
buildDocker.sh Fix buildDocker exit codes 2020-04-18 10:10:27 +03:00
buildDockerRelease.sh Fix buildDocker exit codes 2020-04-18 10:10:27 +03:00
buildRelease.sh Add codecov support 2020-04-18 10:58:07 +03:00
clean.sh clean.sh now removes buildRelease 2020-04-17 20:18:51 +03:00

README.md

CI

fixmydownloads


The goal of the project is to make the simplest downloads folder organizer that is configured by code making it so small that the whole thing fits in one file! Eliminating the need to manually organize or clean up your downloads folder!

Organizing your current download directory

To organize your current downloads directory, run after installation:

$ ./fixmydl all

No return means success. Note: that this completely cleans your downloads directory.

Installation

Their are multiple ways you can install it. Grab your distro's package from the release section and install it! Or wait for the project to get into your distro repositories (hopefully).

Compiling from Source

Using docker is the recommended way, make sure you have the correct permissions to use docker.

$ ./buildDocker.sh (For debbuggable binary and installers)
$ ./buildDockerRelease.sh (For releasable binary and installers)
$ ./buildArtifacts.sh (For extracting installers into $(PROJECT)/artifacts)

In Linux with a ready C development environment, run:

$ ./build.sh (For debuggable binary)
$ ./buildRelease.sh (For release binary)

The binary is outputted into $(PROJECT)/bin Refer to this section for setting up the application to run on login.

Technical Overview

Overview

The program runs in the background, watching the downloads folder with inotify and copies any new files detected, based on extension of the file, to documents folder. All folders are by default sent to documents/prefix/misc. The projects applies to XDG File directory specification. By default, the prefix is orgdl.

Starting up the application

To make fixmydl run when you login run:

$ echo 'fixmydl' >> ~/.profile

Configuring

There are multiple configuration options present.

Extension ignore list

In file main.c, adding values to element extension_ignore_list will make sure that the application doesn't organize these extensions. For example, by default element: crdownloads is added to ignore temp files that chromium/Chrome uses while downloading content.

/* Example addition */
static const int IGNORE_LIST_SIZE = 2; /* MAKE SURE TO UPDATE THIS */
static const char *extension_ignore_list[] = { "crdownload", "tmp" }; /* Don't add dot */

Notes:

  • Make sure you update IGNORE_LIST_SIZE
  • Make sure you don't add dot for the extension_ignore_list

Prefix Directory

This is the name or sub-path to where the categories should be placed in the documents directory. By default, it is set to orgdl. Ex: .txt files should be placed into $HOME/$DOCS/orgdl/txt. To disable this, set it's value to ""

/* Example change */
static const char prefix_dir[] = "organize/folder"; /* Do not end with trailing forward-slashes. */
/* Example disable */
static const char prefix_dir[] = "";

Note:

  • Make sure you don't end prefix_dir with trailing forward-slashes.

Miscellaneous Directory

This is the name of the directory where file and folder without a name are placed. By default, it's set to misc. Example: test is placed into $HOME/$DOCS/$sprefix_dir/misc/

/* Example change*/
static const char misc_dir_default[] = "miscellaneous"; /* Do not end with trailing forward-slashes. */

Note:

  • Make sure you don't end misc_dir_default[] with trailing forward-slashes.

Downloads & Documents Directories

If automatic checking of XDG fails, the program falls back to pwd struct method. If that fails too, then it defaults to downloads_dir_default[] and documents_dir_default[] respectively. By default, downloads_dir_default[] is set to Downloads, and documents_dir_defaults[] is set to Documents, relative to $HOME.

/* Default Downloads change example */
static const char downloads_dir_default[] = "dl"; /* Do not end with trailing forward-slashes */
/* Default Documents change example */
static const char documents_dir_default[] = "dox"; /* Do not end with trailing forward-slashes */

Note:

  • Make sure you don't end downloads_dir_default[] or documents_dir_default[] with trailing forward-slashes.

Advanced Configuration

This section is dedicated of the configuration of how the application operates in a low level. It won't be noticed for the average user.

EVENT_BUF_LEN

The application should consume very little memory. Options like EVENT_BUF_LEN can be used to limit the amount of events read per iteration of the main while loop.

/* Example change */
#define EVENT_BUF_LEN (512 * (EVENT_SIZE + 16))
PATH_BUF_LEN

This is the amount of bytes to allocate for path buffers. Usually, ext4 supports upto 4096 characters. Which is the default.

/* Example change */
#define PATH_BUF_LEN 3072
CMD_BUF_LEN

This is the amount of bytes to allocate for command line buffers. It's a must for it to be atleast 2 times the size of PATH_BUF_LEN and a little more room, because move operations use command line.

/* Example change */
#define CMD_BUF_LEN ((PATH_BUF_LEN * 2) * 1.1) /* Do not remove the brackets. */

Built With

  • C - Language used.
  • inotify - Linux library used for watching files.

Authors

License

This project is licensed under the GPLv3 License - see the LICENSE.md file for details.

Inspiring

I never found a downloads folder organizer that is so simple that you just install it and forget about it. Adding, I wanted to a project that would be suckless-compatible (if that exists). It's worthy to note that I made a 5-minute research 'session' about download organizer for Linux and didn't find any. Therefore I called this project the simplest.


README.md valid for version 1.3.0