1. 30
    1. 3

      Small shell scripts are your friend, something like:

      cat << 'EOF' > /usr/local/bin/publicise-recording
      cd /var/recordings
      mv "$@" public/
      cd -

      Then, hit their hand with a ruler when they use mv, rather than the script.

      You may have grand plans for VOD and making recordings public by default, but those plans may not come to fruition for another year, if ever, but if you spend 5 minutes putting up guards around dangerous manual processes, you won’t have to spend hours grepping through binary files…

      1. 5

        I think that last cd is superfluous

        1. 1

          Nah, it would move you back to the directory you started in.

          1. 9

            It won’t do either. It operates in the context of the shell process running the script, which is a sub process of the shell you invoke it from. That shell’s CWD will be unaffected.

        2. 1

          Yeah, that was just a nice thing to put them back where they were, if they were in a different directory

          1. 3

            That would only matter if the script was sourced though.

    2. 2

      This makes me wonder whether the following interface wouldn’t be better:

      to DEST SOURCE

      Then you’d never forget the directory.

      GNU mv provides the -t option:

      mv -t DIRECTORY SOURCE...

      It might be a good idea to always use that, when moving files into a directory. Note that it’s not POSIX, though.

      1. 1

        I think that’s what tar does right ?