LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2004, 09:02 AM   #1
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Rep: Reputation: 15
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
 
Old 06-21-2004, 09:06 AM   #2
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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
 
Old 06-21-2004, 09:18 AM   #3
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 06-21-2004, 10:30 AM   #4
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
Anyone have a suggestion??
 
Old 06-21-2004, 12:36 PM   #5
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
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
 
Old 06-21-2004, 12:45 PM   #6
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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..
 
Old 06-21-2004, 12:49 PM   #7
dennis_89
LQ Newbie
 
Registered: Jun 2004
Posts: 27

Original Poster
Rep: Reputation: 15
Thanks anyway, I will look around.

Cheers,

Dennis
 
Old 06-21-2004, 10:14 PM   #8
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

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


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Backup of directory sanjibgupta Linux - Networking 2 09-05-2005 12:32 AM
replacing all spaces in filenames of a directory merlin23 Linux - Newbie 1 01-11-2005 07:52 AM
smbclient spaces in directory names? darkleaf Linux - Networking 2 11-23-2004 02:25 PM
directory-names with spaces... Schmurff Linux - Newbie 2 03-07-2004 11:06 AM
cd to a directory with spaces? GT_Onizuka Linux - Newbie 3 08-28-2003 05:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration