Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6932

Troubleshooting • Script Help - Files Not Copied

$
0
0
RPi 5 setup with standard SSD boot/root file system and a USB drive for extra storage (mainly MP3 music files). I have a folder on the SSD that I want to backup its 6 files to a folder on the USB drive mounted as "usb64", but even more, I want to keep 3 sets of backups, so within /mnt/usb64/Backup folder - I have subfolders b1, b2 and b3. I have a script that will run every other day which is supposed to:
copy files from b2 to b3 (overwriting the existing files in b3) - my oldest backup set
copy files from b1 to b2 (overwriting the existing files in b2) - my 2nd oldest backup set
copy files from SSD source file directory to b1 (overwriting the existing files in b1) - my latest backup set

When I run my script, the 6 files from the source directory are copied to the b1 directory on the USB drive. So this proves I can copy files from SSD to USB. My problem is that the script is NOT copying files from b2 to b3 nor b1 to b2. I do not get any errors, but nothing is getting copied. I have even tried the copy command from the command line. No error messages, but nothing gets copied. Folder permissions are same for all folders involved. below is my script - any ideas?

Code:

#!/bin/bash# copy/overwrite files from 2nd backup folder to 3rd backup folderyes | cp -rf /mnt/usb64/Backup/b2/*.* /mnt/usb64/Backup/b3sleep 5# copy/overwrite files from 1st backup folder to 2nd backup folderyes | cp -rf /mnt/usb64/Backup/b1/*.* /mnt/usb64/Backup/b2sleep 5# copy/overwrite source files to 1st backup folderyes | cp -rf /home/pi/folder2save/*.* /mnt/usb64/Backup/b1#complete

Statistics: Posted by Loke — Mon Apr 28, 2025 5:13 pm



Viewing all articles
Browse latest Browse all 6932

Trending Articles