qmove - Linux


Overview

qmove is a powerful command-line utility that allows you to move or rename files and directories efficiently in Linux systems. It provides advanced functionality for complex file operations, including wildcard matching and recursive options.

Syntax

qmove [-n] [-v] [-i] [-f] [-a] [-l sym_link] [-S] [-h] <source_path> <destination_path>

Options/Flags

  • -n: Dry run mode, displays actions without actually making changes.
  • -v: Verbose mode, provides detailed output for each operation.
  • -i: Interactive mode, prompts for confirmation before each operation.
  • -f: Force mode, overwrites existing files without prompting.
  • -a: Archive mode, preserves file metadata (e.g., timestamps).
  • -l sym_link: Creates a symbolic link instead of moving the file.
  • -S: Strip trailing slashes from destination paths.
  • -h: Displays help information.

Examples

  • Move a single file: qmove file.txt new_dir/
  • Move multiple files with wildcard: qmove *log.txt log_archive/
  • Rename a file and preserve metadata: qmove -a old_name.txt new_name.txt
  • Move directories recursively: qmove -r /old_dir/ /new_dir/
  • Create a symbolic link: qmove -l /old_file /new_link

Common Issues

  • File exists: If the destination file already exists, qmove will prompt for confirmation in interactive mode (-i). Force mode (-f) can be used to overwrite the file without prompting.
  • Path errors: Ensure that source and destination paths are valid and have the correct permissions.
  • Recursive operations: When moving directories recursively, be aware that symbolic links may not be followed by default. Use the -rS option to include symbolic links.

Integration

qmove can be used in combination with other commands for advanced operations:

  • Create a tar archive: qmove -r /dir/ tar_archive.tar
  • Sync files over SSH: qmove -v local_file user@remote_host:/remote_dir/
  • Pipe output to xargs for further processing: qmove -n *log.txt | xargs rm

Related Commands

  • mv: Similar to qmove, but lacks wildcard and recursive options.
  • rsync: A powerful tool for file synchronization and backup.
  • find: A utility for searching and filtering files based on various criteria.