Mac – can i find usb path and save to variable for quick backups

backupbashmacpath

i would like to add the path to inserted flash drive named backup1 to a variable so i can copy /Documents/dir to this flash drive path in one script without user interaction

Best Answer

Try B=/Volumes/backup1 and then cp -p /Documents/dir/* $B.