shift - macOS


Overview

Shift is a macOS command-line utility that allows you to move or rename files in bulk by providing intuitive syntax. It offers advanced file manipulation capabilities while maintaining simplicity and efficiency.

Syntax

shift [-a][-c][-f][-h][-n][-r][-s][-t][-v] <paths> [<dest_path>]

Options/Flags

  • -a: Apply to all subdirectories.
  • -c: Copy instead of move.
  • -f: Ignore errors while processing.
  • -h: Display help information.
  • -n: Perform a dry run without making any changes.
  • -r: Recursively move or copy subdirectories as well.
  • -s: Simulate the operation, showing the changes without executing them.
  • -t: Move or copy files to the provided dest_path. (Default: current working directory)
  • -v: Enable verbose output to report each action taken.

Examples

  • Move all files from Downloads to Documents:
shift /Downloads /Documents
  • Recursively copy all files from Photos/2023 to Backup:
shift -r -c /Photos/2023 /Backup
  • Simulate moving files from Temp to Archive:
shift -s /Temp /Archive

Common Issues

  • Permission denied: Ensure you have sufficient permissions to manipulate the files and directories.
  • Destination path does not exist: Use -t to specify the destination path if it doesn’t exist yet.
  • File already exists at destination: Use -f to overwrite existing files, or -c to copy without overwriting.

Integration

Shift can be integrated with other commands:

  • Finder: Drag files onto the Terminal window to automatically populate .
  • AppleScript: Use do shell script to execute shift commands from within an AppleScript.
  • mv: Move files in a more limited way.
  • cp: Copy files.
  • rsync: Synchronize files and directories.
  • ditto: Create disk images and copy files recursively.