From 9396602598d19f73a141cf4d8cd277e7d0baed1e Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sun, 11 Oct 2020 23:58:33 -0400 Subject: [PATCH] Add handling for exe file types --- readme.md | 3 +++ run.sh | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/readme.md b/readme.md index 5044d5d..53c4ef4 100644 --- a/readme.md +++ b/readme.md @@ -12,3 +12,6 @@ Organizes files by type. ### Args * First arg (required) - Expected to be the input directory. * Second arg (required) - Expected to be the output directory. + +### Flags +* `-no-exe` - Skips handling of windows exe files. diff --git a/run.sh b/run.sh index 4a43398..6ea0b08 100755 --- a/run.sh +++ b/run.sh @@ -208,6 +208,25 @@ function handle_file () { move_file + # Handle windows executable files. + elif [[ "${file_extension}" == ".exe" ]] + then + # Only proceed if flags aren't set. + if [[ ! "${flags[@]}" =~ "no-exe" ]] + then + output_subdir="${output_dir}/Executables" + + # Verify location exists. + if [[ ! -d ${output_subdir} ]] + then + mkdir ${output_subdir} + fi + + # Move file. + move_file + fi + + # Handle all other file types. else # Check if file had a period in its name. If so, we can check against a smaller extension value. -- GitLab