I'm configuring Spring Security across all my controllers.
I want some method executions to start only when "my system is enabled". This information is accessible from all over the controllers via a specific static method (I can make it non-static).
My point is that I want to avoid making an explicit check in java code at the beginning of every method.
How can I get there via Spring Security?


Question: Copying Files in a Folder To Individual Folders
Answer: Write a shell script which gets the files as parameters:

#!/bin/bash

for filepath; do
  parentpath="${filepath%/*}"
  if [ "$parentpath" != "$filepath" ]; then # $file contains a /
    file="${filepath#"$parentpath"/}"
  else
    file="$filepath"
    parentpath=""
  fi
  filename="${file%.*}"
  if [ -z "$parentpath" ]; then
    mkdir -p "$filename" &amp;&amp; mv "$file" "$filename"
  else
    mkdir -p "${parentpath}/$filename" &amp;&amp;
      mv "$filepath" "${parentpath}/$filename"
  fi
done


You can call this script as ./script *.ext1 *.ext2 *.ext3 for not too huge numbers of files or as find ... -exec ./script {} + for huge numbers.