How to verify the file moved?

To verify that a file has been successfully moved to a USB drive (or any destination), you can follow these steps:

Step 1: Check the Source Location

Before moving the file, you can list the files in the source directory to confirm the file's existence:

ls /path/to/source/

Step 2: Check the Destination Location

After moving the file, list the files in the destination directory (the USB drive in this case) to ensure the file is there:

ls /mnt/usb/

Step 3: Compare File Sizes or Checksums

To ensure that the file has not been corrupted during the move, you can compare the file sizes or checksums (using md5sum or sha256sum).

  1. Check File Size:

    • Check the size of the original file:
    stat /path/to/source/backup_file.dump
    • Check the size of the moved file:
    stat /mnt/usb/backup_file.dump

    Ensure that the sizes match.

  2. Check Checksums:

    • Generate a checksum for the original file:
    md5sum /path/to/source/backup_file.dump
    • Generate a checksum for the moved file:
    md5sum /mnt/usb/backup_file.dump

    Compare the two checksums. If they match, the file has been moved successfully without corruption.

Summary

  1. List files in the source and destination directories to confirm the move.
  2. Optionally, compare file sizes or checksums to ensure integrity.

By following these steps, you can verify that the file has been successfully moved to the desired location.

0 Comments

no data
Be the first to share your comment!