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).
-
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.dumpEnsure that the sizes match.
-
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.dumpCompare the two checksums. If they match, the file has been moved successfully without corruption.
Summary
- List files in the source and destination directories to confirm the move.
- 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.
