LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   backup from directory with spaces (https://www.linuxquestions.org/questions/linux-networking-3/backup-from-directory-with-spaces-195956/)

dennis_89 06-21-2004 09:02 AM

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

b0uncer 06-21-2004 09:06 AM

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

dennis_89 06-21-2004 09:18 AM

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

dennis_89 06-21-2004 10:30 AM

Anyone have a suggestion??

dennis_89 06-21-2004 12:36 PM

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

b0uncer 06-21-2004 12:45 PM

Quote:

This doesn't seem to be working. Would I have to put:

BACKUP_SHARE="backup test"

or

"BACKUP_SHARE=backup test"
it was the upper one of those I thought...but if it won't work, then I have no clue :/ sorry..I don't do this kind of scripting that much myself..but I think someone has asked a thing like this earlier...I'm not sure if it was just like this, but had something to do with spaces in scripting...damn, if only I could remember what thread it was..

dennis_89 06-21-2004 12:49 PM

Thanks anyway, I will look around.

Cheers,

Dennis

stickman 06-21-2004 10:14 PM

Did you try:
BACKUP_SHARE="backup\ test"
with the space after the backslash?


All times are GMT -5. The time now is 03:20 AM.