backup from directory with spaces
I have written a backup script to allow for backups from across a windows network and am having trouble with backing up directories that have spaces as their name i.e backup test. It works if the share name is backup_test. I know that linux doesn't like spaces and can use \ to specify a space but that is not working. Does anyone have any suggestions?
Cheers, Dennis |
try to enclose the filename/whole path inside "" -marks, like
"backup test" instead of backup test OR backup\ test dunno if it helps...but it's often quicker at least in bash usage than \ -marks |
This doesn't seem to be working. Would I have to put:
BACKUP_SHARE="backup test" or "BACKUP_SHARE=backup test" I tried the first one and that doesn't work for me. Any other ideas other than having everyone change the directories? Some of this directories are shares that involve microsoft paths i.e c:\program files ... etc Cheers, Dennis |
Anyone have a suggestion??
|
here is a copy of the script:
#!/bin/bash #this is the administrator account on the windows machines USERNAME1=administrator PASSWORD1=administrator_password # DRIVE=/root/backup # TARGET_MACHINE=laptop BACKUP_SHARE=backup test ***this is where the trouble lies*** # mkdir $DRIVE/$TARGET_MACHINE cd $DRIVE/$TARGET_MACHINE # smbclient //$TARGET_MACHINE/$BACKUP_SHARE $PASSWORD1 -U $USERNAME1 -c "recurse;prompt;mget *;" # tar cvpz $DRIVE/$TARGET_MACHINE > $DRIVE/$TARGET_MACHINE.tar.gz rm -rf $DRIVE/$TARGET_MACHINE # Cheers, Dennis |
Quote:
|
Thanks anyway, I will look around.
Cheers, Dennis |
Did you try:
BACKUP_SHARE="backup\ test" with the space after the backslash? |
All times are GMT -5. The time now is 03:09 PM. |