Re: recursive copy with spaces in descendants

2011-11-08 Thread Chris Whitehouse

On 05/11/2011 19:47, Chris wrote:

I'm having difficulty copying a directory tree from my FreeBSD server to
USB storage. The problem is that the tree contains file and folder names
which have spaces, similar to the following:

./foo bar/some name.tar.gz
./foo bar/child dir/some other name.tar.gz

I've tried various combinations of cp with enclosing the top level
directory in quotations, along with other commands like tar or xargs  to no
avail. The problem seems to be with creating the destination directories
and folders, where mkdir/cp terminates with an invalid argument response.

Cleaning up the source filenames using something like detox isn't viable,
as the files are being served by transmission-daemon, and as such the names
must be preserved. Permissions are not an issue either, as the same
responses occur whether I use a standard or root account.

Any ideas would be greatly appreciated, since I'm pretty much out of them
at this point.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org



%mount_msdosfs /dev/da0s1  mnt #USB external HD
%ls mnt
%cd ~/temp2
%find .
.
./dir with spaces
./dir with spaces/file1 with spaces
./dir with spaces/file2 with spaces
%find . -depth |cpio -pdmv ~/mnt
/home/chrisw/mnt/./dir with spaces/file1 with spaces
/home/chrisw/mnt/./dir with spaces/file2 with spaces
/home/chrisw/mnt/./dir with spaces
/home/chrisw/mnt/.
0 blocks
%find ~/mnt
/home/chrisw/mnt
/home/chrisw/mnt/dir with spaces
/home/chrisw/mnt/dir with spaces/file1 with spaces
/home/chrisw/mnt/dir with spaces/file2 with spaces

or have I missed something?

Chris
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-06 Thread Polytropon
On Sat, 5 Nov 2011 15:47:20 -0400, Chris wrote:
 I'm having difficulty copying a directory tree from my FreeBSD server to
 USB storage. The problem is that the tree contains file and folder names
 which have spaces, similar to the following:

The thing you're intending to name are properly
called directories, not folders. :-)



 ./foo bar/some name.tar.gz
 ./foo bar/child dir/some other name.tar.gz
 
 I've tried various combinations of cp with enclosing the top level
 directory in quotations, along with other commands like tar or xargs  to no
 avail. The problem seems to be with creating the destination directories
 and folders, where mkdir/cp terminates with an invalid argument response.

That's a typical problem caused by those who put
spaces into filenames: Scripting requires more work
to do what you intend.

I may point you to the following articles that
deal with the _result_ of your problem:

David A. Wheeler
Filenames and Pathnames in Shell: How to do it correctly
http://www.dwheeler.com/essays/filenames-in-shell.html

David A. Wheeler:
Fixing Unix/Linux/POSIX Filenames:
Control Characters (such as Newline), Leading Dashes, and Other Problems
http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html

However, if you _can_, solve the _cause_ of your
problem, i. e. educate those who create that
kind of trouble-carrying file and directory names
_not_ to use spaces!



 Any ideas would be greatly appreciated, since I'm pretty much out of them
 at this point.

The articles should help you to deal with the problem,
as they present properly working solutions.

Good luck!



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-06 Thread Michael Sierchio
On Sun, Nov 6, 2011 at 6:35 AM, Polytropon free...@edvax.de wrote:

 However, if you _can_, solve the _cause_ of your
 problem, i. e. educate those who create that
 kind of trouble-carrying file and directory names
 _not_ to use spaces!

Amen, Brother.  Just because you *can*, doesn't mean you should.  I
blame Mac users. ;-)

- M
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-06 Thread Ian Smith
In freebsd-questions Digest, Vol 387, Issue 10, Message: 34
On Sat, 5 Nov 2011 18:49:29 -0400 Chris cpubur...@gmail.com wrote:
  On Sat, Nov 5, 2011 at 6:20 PM, Michael Sierchio ku...@tenebras.com wrote:
   On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote:
   I apologize for the lack of detail. The command I'm using is:
   ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd
   /mnt/usb ; tar xf - )
  
   Show, don't tell. What does tar report when you run it?

Indeed this helps, especially now we also know it's msdosfs ..

  The following messages display:
  
  ./: Can't set user=921/group=921 for .
  ./Reboot S1 - 01 [3FD6C4B2].mkv: Can't create 'Reboot S1 - 01 [3FD6C4B2].mkv'
  
  The last message (can't create) repeats for all files in the
  directory. Running 'ls -al /mnt/usb' yields:
  
  drwxr-xr-x   1  rootwheel 32768Dec 31 1979  .
  drwxr-xr-x   1  rootwheel 512Nov  5 03:04  ..
  
  Where /mnt/usb was originally empty in the first place.

Something I've seen noone mention is that msdosfs has no concept of user 
or group, so Can't set user=921/group=921 for . makes perfect sense. 

Your 'ls -al' above showing root wheel indicates permissions related 
to the mount point.  If you'd mounted it as a normal user it could show 
user user ownerships, unrelated to what msdosfs stores on the disk. 
Similarly, mount_msdosfs(8) -u, -g and -m switches don't affect what's 
written to the disk, but only how the filesystem appears to FreeBSD.

For example, a 'cp -pR /etc /mnt/usb also complains about not being 
able to set the ownership or permissions (other than DOS' read-only 
attribute) on target files, but it will still copy them ok, including 
filenames with spaces - but not with ',+' or other non-DOS characters.

So maybe tar gives up before writing, because the ownership is wrong?

Perhaps the -o and -p options to tar(1) might help here, but the bottom 
line is that msdosfs is not really a suitable target for UFS files.  I 
tend to use zip(1)  - which keeps perms and ownership, though not hard 
links - to stash dirs and files on msdosfs, but format flash disks - or 
at least one or more slices on them - as UFS for real backup purposes.

cheers, Ian
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


recursive copy with spaces in descendants

2011-11-05 Thread Chris
I'm having difficulty copying a directory tree from my FreeBSD server to
USB storage. The problem is that the tree contains file and folder names
which have spaces, similar to the following:

./foo bar/some name.tar.gz
./foo bar/child dir/some other name.tar.gz

I've tried various combinations of cp with enclosing the top level
directory in quotations, along with other commands like tar or xargs  to no
avail. The problem seems to be with creating the destination directories
and folders, where mkdir/cp terminates with an invalid argument response.

Cleaning up the source filenames using something like detox isn't viable,
as the files are being served by transmission-daemon, and as such the names
must be preserved. Permissions are not an issue either, as the same
responses occur whether I use a standard or root account.

Any ideas would be greatly appreciated, since I'm pretty much out of them
at this point.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Michael Sierchio
I just use tar for this.

( cd /path/to/src ; tar cf - . ) | ( cd /path/to/obj ; tar xf - )

- M

On Sat, Nov 5, 2011 at 12:47 PM, Chris cpubur...@gmail.com wrote:
 I'm having difficulty copying a directory tree from my FreeBSD server to
 USB storage. The problem is that the tree contains file and folder names
 which have spaces, similar to the following:

 ./foo bar/some name.tar.gz
 ./foo bar/child dir/some other name.tar.gz

 I've tried various combinations of cp with enclosing the top level
 directory in quotations, along with other commands like tar or xargs  to no
 avail. The problem seems to be with creating the destination directories
 and folders, where mkdir/cp terminates with an invalid argument response.

 Cleaning up the source filenames using something like detox isn't viable,
 as the files are being served by transmission-daemon, and as such the names
 must be preserved. Permissions are not an issue either, as the same
 responses occur whether I use a standard or root account.

 Any ideas would be greatly appreciated, since I'm pretty much out of them
 at this point.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Lowell Gilbert
Michael Sierchio ku...@tenebras.com writes:

 I just use tar for this.

 ( cd /path/to/src ; tar cf - . ) | ( cd /path/to/obj ; tar xf - )

I was going to launch into an explanation of shell quoting, but come to
think of it, tar is how I do this too.

 On Sat, Nov 5, 2011 at 12:47 PM, Chris cpubur...@gmail.com wrote:
 I'm having difficulty copying a directory tree from my FreeBSD server to
 USB storage. The problem is that the tree contains file and folder names
 which have spaces, similar to the following:

 ./foo bar/some name.tar.gz
 ./foo bar/child dir/some other name.tar.gz

I think:
cp foo\ bar/some\ name.tar.gz some_other_path/.

will work for all shells.  
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Chris
The tar one-liner is similar what I used to use on Gentoo and Arch
linux, so I thought it strange that it isn't working here. I'm still
having problems though, since the command returns  Can't create
'$FILENAME'  for all files found.

I quick tested by telling the tar command to copy to /tmp instead, and
it worked fine. Copying a few test files created with ee transfer to
/mnt/usb fine as well. I'm thinking there may be some characters (or
even name length) that are causing the problem. Are there restrictions
on filename characters/length on drives mounted with msdosfs? The
mount entry for the drive is:

/dev/da0s1 on /mnt/usb (msdosfs, local)  #with -o longnames
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Lowell Gilbert
Chris cpubur...@gmail.com writes:

 The tar one-liner is similar what I used to use on Gentoo and Arch linux,
 so I thought it strange that it isn't working here. I'm still having
 problems though, since the command returns  Can't create '$FILENAME'  for
 all files found.

It would have been a good idea to show us the command you used that
produced this.  Without that, all we can do is say I don't know; it
works for me!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Michael Sierchio
Oh, and what kind of filesystem is on the USB device?

- M

On Sat, Nov 5, 2011 at 2:48 PM, Lowell Gilbert
freebsd-questions-lo...@be-well.ilk.org wrote:
 Chris cpubur...@gmail.com writes:

 The tar one-liner is similar what I used to use on Gentoo and Arch linux,
 so I thought it strange that it isn't working here. I'm still having
 problems though, since the command returns  Can't create '$FILENAME'  for
 all files found.

 It would have been a good idea to show us the command you used that
 produced this.  Without that, all we can do is say I don't know; it
 works for me!
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Lowell Gilbert
Michael Sierchio ku...@tenebras.com writes:

 Oh, and what kind of filesystem is on the USB device?

msdosfs.

Sorry; I trimmed that from what I quoted.

 - Lowell

 - M

 On Sat, Nov 5, 2011 at 2:48 PM, Lowell Gilbert
 freebsd-questions-lo...@be-well.ilk.org wrote:
 Chris cpubur...@gmail.com writes:

 The tar one-liner is similar what I used to use on Gentoo and Arch linux,
 so I thought it strange that it isn't working here. I'm still having
 problems though, since the command returns  Can't create '$FILENAME'  for
 all files found.

 It would have been a good idea to show us the command you used that
 produced this.  Without that, all we can do is say I don't know; it
 works for me!
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Chris
I apologize for the lack of detail. The command I'm using is:
( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd
/mnt/usb ; tar xf - )

I've also tried:
cp -afv /usr/local/etc/transmission/home/Downloads /mnt/usb
rsync -aq /usr/local/etc/transmission/home/Downloads /mnt/usb
find . -print0 | xargs -0 -I {} cp {} /mnt/usb #when in source directory

Filesystem on USB drive is FAT32, 32k blocksize, 16GB capacity,
formatted on a Windows 7 box.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Michael Sierchio
On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote:
 I apologize for the lack of detail. The command I'm using is:
 ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd
 /mnt/usb ; tar xf - )

Show, don't tell. What does tar report when you run it?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Chris
On Sat, Nov 5, 2011 at 6:20 PM, Michael Sierchio ku...@tenebras.com wrote:
 On Sat, Nov 5, 2011 at 3:15 PM, Chris cpubur...@gmail.com wrote:
 I apologize for the lack of detail. The command I'm using is:
 ( cd /usr/local/etc/transmission/home/Downloads/ ; tar cf - . ) | ( cd
 /mnt/usb ; tar xf - )

 Show, don't tell. What does tar report when you run it?


The following messages display:

./: Can't set user=921/group=921 for .
./Reboot S1 - 01 [3FD6C4B2].mkv: Can't create 'Reboot S1 - 01 [3FD6C4B2].mkv'

The last message (can't create) repeats for all files in the
directory. Running 'ls -al /mnt/usb' yields:

drwxr-xr-x   1  rootwheel 32768Dec 31 1979  .
drwxr-xr-x   1  rootwheel 512Nov  5 03:04  ..

Where /mnt/usb was originally empty in the first place.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: recursive copy with spaces in descendants

2011-11-05 Thread Chris
On a hunch, I gave the following a shot:

tar -cvlf - '/usr/local/etc/transmission/home/Downloads'/ | split -a 2
-b 3900m - /mnt/usb/TX_DL.tar.

which created a split tar archive of the files on /mnt/usb. I'm still
thinking there's something with the source path/file names that the
msdosfs driver on BSD doesn't like, but at least this way is usable
for the intended scenario.

I guess I'll call this solved unless you all have some insight as to
why the original method wasn't working.

Thanks for all the help so far!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


no spaces ....

2010-10-31 Thread Gary Kline


Looks like the spacebar on my clicky keyboard is busted.  Same thing
on FBSD as on the desktop [[ubuntu]]].  I'm typing this on my
laptop.  Seems like every other key works.  

Another thing is that the ctl key seems not to work.  IF I type
A ^c I get c.  ^D yields simply d.  Is here any chance this can be a 
software glitch?  Can't see how tho since I can KVM button from 
a konsoleon tao [desktop] to an xterm on ethic  No spacebar.

Suggestions?  This might be time to buy a USB clicky kybd.

gary



-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
The 7.90a release of Jottings: http://jottings.thought.org/index.php
   http://journey.thought.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: no spaces ....

2010-10-31 Thread Polytropon
On Sat, 30 Oct 2010 23:58:31 -0700, Gary Kline kl...@thought.org wrote:
 Looks like the spacebar on my clicky keyboard is busted.  Same thing
 on FBSD as on the desktop [[ubuntu]]].  I'm typing this on my
 laptop.  Seems like every other key works.  

You can remap one of the unused advertising keys (those that
are for Windows to be an additional space key.

The keycode should be 115 or 116 or similar. I can't check as
I do not own ANY keyboard with Windows keys on it. You can
easily find it out by (installing and) running

% xev

and pressing those keys - the number will then be displayed,
and by default, a key symbol should be assigned. Here's an
example:

KeyPress event, serial 27, synthetic NO, window 0x121,
root 0x73, subw 0x0, time 18453834, (43,160), root:(203,623),
state 0x10, keycode 115 (keysym 0xffe7, Meta_L), same_screen YES,
XLookupString gives 0 bytes: 
XmbLookupString gives 0 bytes: 
XFilterEvent returns: False

KeyRelease event, serial 27, synthetic NO, window 0x121,
root 0x73, subw 0x0, time 18453902, (43,160), root:(203,623),
state 0x18, keycode 115 (keysym 0xffe7, Meta_L), same_screen YES,
XLookupString gives 0 bytes: 
XFilterEvent returns: False

This is the left Meta key on the Sun USB keyboard I'm currently
using: Its keycode is 115, the symbol currently assigned is Meta_L.

If you would want to make that an additional space bar, create
~/.xmodmaprc and code

keycode 115 = space

Your X startup file (~/.xinitrc or ~/.xsession) should load this
file if present:

[ -f ~/.xmodmaprc ]  xmodmap ~/.xmodmaprc

This would be a simple workaround for nonworking keys.



 Another thing is that the ctl key seems not to work.  IF I type
 A ^c I get c.  ^D yields simply d. 

Same here, 

keycode 115 = Control_L
keycode 116 = space

could be a temporary solution.



 Is here any chance this can be a 
 software glitch? 

Could be possible - I've experienced something similar with a
nonworking left shift key, or keys stuck in control mode.
A bit hammering on the keyboard and some focus-shifting
solved the problem. It does happen once a few months and is
not predictable. Maybe some USB issue? Polling?



 Can't see how tho since I can KVM button from 
 a konsoleon tao [desktop] to an xterm on ethic  No spacebar.

So switching over from one system to another does keep the
problem... maybe a mechanical or electrical problem caused
by the keyboard?



 Suggestions?  This might be time to buy a USB clicky kybd.

In any case, try to check with xev and see what - IF - really
happens when pressing keys.

I can recommend the Sun USB keyboard (I have model 6 here, but
model 7 should be fine, too). It's not IBM clicky quality, of
course. It's not clicky at all. But it's very comfortable and
feels still good in use. The 2x5 plus 1 extra keys on the left
and the 4 on the right are wonderful add-ons - fully programmable
and usable (I use them for window sizing, rolling, focusing,
and starting programs, as well as for volume control, lock
session, log out and shutdown); Compose is also a nice feature,
as well as the real Meta keys. You can get them for cheap
via eBay, for example. Pay attention to get a USB model - you
won't be able to use the regular serial ones (with the round
plug) on a PC.

This is the only USB keyboard I have. All other systems use
PS/2 IBM keyboards intendedly. Never had a problem with them,
even after Cola shower and disassembly. :-)



-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: no spaces ....

2010-10-31 Thread Gary Kline
On Sun, Oct 31, 2010 at 08:16:13AM +0100, Polytropon wrote:
 On Sat, 30 Oct 2010 23:58:31 -0700, Gary Kline kl...@thought.org wrote:
  Looks like the spacebar on my clicky keyboard is busted.  Same thing
  on FBSD as on the desktop [[ubuntu]]].  I'm typing this on my
  laptop.  Seems like every other key works.  
 
 You can remap one of the unused advertising keys (those that
 are for Windows to be an additional space key.
 
 The keycode should be 115 or 116 or similar. I can't check as
 I do not own ANY keyboard with Windows keys on it. You can
 easily find it out by (installing and) running
 
   % xev
 
 and pressing those keys - the number will then be displayed,
 and by default, a key symbol should be assigned. Here's an
 example:
 
 KeyPress event, serial 27, synthetic NO, window 0x121,
 root 0x73, subw 0x0, time 18453834, (43,160), root:(203,623),
 state 0x10, keycode 115 (keysym 0xffe7, Meta_L), same_screen YES,
 XLookupString gives 0 bytes: 
 XmbLookupString gives 0 bytes: 
 XFilterEvent returns: False
 
 KeyRelease event, serial 27, synthetic NO, window 0x121,
 root 0x73, subw 0x0, time 18453902, (43,160), root:(203,623),
 state 0x18, keycode 115 (keysym 0xffe7, Meta_L), same_screen YES,
 XLookupString gives 0 bytes: 
 XFilterEvent returns: False
 
 This is the left Meta key on the Sun USB keyboard I'm currently
 using: Its keycode is 115, the symbol currently assigned is Meta_L.
 
 If you would want to make that an additional space bar, create
 ~/.xmodmaprc and code
 
   keycode 115 = space
 
 Your X startup file (~/.xinitrc or ~/.xsession) should load this
 file if present:
 
   [ -f ~/.xmodmaprc ]  xmodmap ~/.xmodmaprc
 
 This would be a simple workaround for nonworking keys.
 
 
 
  Another thing is that the ctl key seems not to work.  IF I type
  A ^c I get c.  ^D yields simply d. 
 
 Same here, 
 
   keycode 115 = Control_L
   keycode 116 = space
 
 could be a temporary solution.
 
 
 
  Is here any chance this can be a 
  software glitch? 
 
 Could be possible - I've experienced something similar with a
 nonworking left shift key, or keys stuck in control mode.
 A bit hammering on the keyboard and some focus-shifting
 solved the problem. It does happen once a few months and is
 not predictable. Maybe some USB issue? Polling?
 
 
 
  Can't see how tho since I can KVM button from 
  a konsoleon tao [desktop] to an xterm on ethic  No spacebar.
 
 So switching over from one system to another does keep the
 problem... maybe a mechanical or electrical problem caused
 by the keyboard?
 
 
 
  Suggestions?  This might be time to buy a USB clicky kybd.
 
 In any case, try to check with xev and see what - IF - really
 happens when pressing keys.
 
 I can recommend the Sun USB keyboard (I have model 6 here, but
 model 7 should be fine, too). It's not IBM clicky quality, of
 course. It's not clicky at all. But it's very comfortable and
 feels still good in use. The 2x5 plus 1 extra keys on the left
 and the 4 on the right are wonderful add-ons - fully programmable
 and usable (I use them for window sizing, rolling, focusing,
 and starting programs, as well as for volume control, lock
 session, log out and shutdown); Compose is also a nice feature,
 as well as the real Meta keys. You can get them for cheap
 via eBay, for example. Pay attention to get a USB model - you
 won't be able to use the regular serial ones (with the round
 plug) on a PC.
 
 This is the only USB keyboard I have. All other systems use
 PS/2 IBM keyboards intendedly. Never had a problem with them,
 even after Cola shower and disassembly. :-)
 

It  _was_ the kybd; fortunately, being  a packrat, i still have
the 2003  Dell, *and* since it has a PS/2 plug, it fits my
temporary  adaptor.  ___WHEW___  

I have the click part of the driver working, but that's  all.  
``xset x 50'' never has worked under BSD [ ditto linux ] ...
soo I'm stuck with buying the click-type keyboards.  Why this
is such a big deal, I have 0.0  clue.   Given that we do have
people more familiar with hacking drivers.  Oh well.

gary

PS:  xev.  Couldn't remember that, tho I've used it pretty
often.


 
 
 -- 
 Polytropon
 Magdeburg, Germany
 Happy FreeBSD user since 4.0
 Andra moi ennepe, Mousa, ...

-- 
 Gary Kline  kl...@thought.org  http://www.thought.org  Public Service Unix
The 7.90a release of Jottings: http://jottings.thought.org/index.php
   http://journey.thought.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Bash Script Help - File Names With Spaces

2010-08-17 Thread Drew Tomlinson
I have a collection of yearly top 100 Billboard mp3s in this format (all 
one line - sorry if it wraps):


/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny 
Loggins - This Is It.mp3


I want to create symbolic links to the top 30 in 1966-1969 in another 
directory for easy migration to a flash card. Thus I invoked 'find' to 
get a list (again, all one line):


find -E /archive/Multimedia/Audio/Music/Billboard Top USA Singles 
-regex '.*19[6-9][0-9]-0[0-2][0-9].*'


(OK, I know this will only return the top 29)

'find' returns the complete filename as above:

/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny 
Loggins - This Is It.mp3


Then I attempt to use 'basename' to extract the file name to a variable 
which I can later pass to 'ln'.  This seems to work:


basename /archive/Multimedia/Audio/Music/Billboard Top USA 
Singles/1980-028 Kenny Loggins - This Is It.mp3


returns (all one line):

1980-028 Kenny Loggins - This Is It.mp3

which is what I would expect.  However using it with 'find' give me this 
type of unexpected result:


for i in `find -E /archive/Multimedia/Audio/Music/Billboard Top USA 
Singles -regex '.*19[6-9][0-9]-0[1-2][0-9].*'`; do basename ${i};done


1980-028
Kenny
Loggins
-
This
Is
It.mp3

Why is this different? And more importantly, how can I capture the file 
name to $i?


Thanks,

Drew

--
Like card tricks?

Visit The Alchemist's Warehouse to
learn card magic secrets for free!

http://alchemistswarehouse.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Chip Camden
Quoth Drew Tomlinson on Tuesday, 17 August 2010:
 I have a collection of yearly top 100 Billboard mp3s in this format (all 
 one line - sorry if it wraps):
 
 /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny 
 Loggins - This Is It.mp3
 
 I want to create symbolic links to the top 30 in 1966-1969 in another 
 directory for easy migration to a flash card. Thus I invoked 'find' to 
 get a list (again, all one line):
 
 find -E /archive/Multimedia/Audio/Music/Billboard Top USA Singles 
 -regex '.*19[6-9][0-9]-0[0-2][0-9].*'
 
 (OK, I know this will only return the top 29)
 
 'find' returns the complete filename as above:
 
 /archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny 
 Loggins - This Is It.mp3
 
 Then I attempt to use 'basename' to extract the file name to a variable 
 which I can later pass to 'ln'.  This seems to work:
 
 basename /archive/Multimedia/Audio/Music/Billboard Top USA 
 Singles/1980-028 Kenny Loggins - This Is It.mp3
 
 returns (all one line):
 
 1980-028 Kenny Loggins - This Is It.mp3
 
 which is what I would expect.  However using it with 'find' give me this 
 type of unexpected result:
 
 for i in `find -E /archive/Multimedia/Audio/Music/Billboard Top USA 
 Singles -regex '.*19[6-9][0-9]-0[1-2][0-9].*'`; do basename ${i};done
 
 1980-028
 Kenny
 Loggins
 -
 This
 Is
 It.mp3
 
 Why is this different? And more importantly, how can I capture the file 
 name to $i?

Try:

find -E ... | while read i; do; basename $i; done

When using back-ticks, all the output gets appended together,
space-separated.  Then 'for' can't tell the difference between a space in
a filename and a delimiter.  Using 'read' instead preserves line
boundaries.

 
 Thanks,
 
 Drew
 
 -- 
 Like card tricks?
 
 Visit The Alchemist's Warehouse to
 learn card magic secrets for free!
 
 http://alchemistswarehouse.com
 
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

-- 
Sterling (Chip) Camden| sterl...@camdensoftware.com | 2048D/3A978E4F
http://camdensoftware.com | http://chipstips.com| http://chipsquips.com


pgpCHrUZ30LlM.pgp
Description: PGP signature


Re: Bash Script Help - File Names With Spaces -- SOLVED

2010-08-17 Thread Drew Tomlinson

On 8/17/2010 7:47 AM, Drew Tomlinson wrote:
I have a collection of yearly top 100 Billboard mp3s in this format 
(all one line - sorry if it wraps):


/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 
Kenny Loggins - This Is It.mp3


I want to create symbolic links to the top 30 in 1966-1969 in another 
directory for easy migration to a flash card. Thus I invoked 'find' to 
get a list (again, all one line):


find -E /archive/Multimedia/Audio/Music/Billboard Top USA Singles 
-regex '.*19[6-9][0-9]-0[0-2][0-9].*'


(OK, I know this will only return the top 29)

'find' returns the complete filename as above:

/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 
Kenny Loggins - This Is It.mp3


Then I attempt to use 'basename' to extract the file name to a 
variable which I can later pass to 'ln'.  This seems to work:


basename /archive/Multimedia/Audio/Music/Billboard Top USA 
Singles/1980-028 Kenny Loggins - This Is It.mp3


returns (all one line):

1980-028 Kenny Loggins - This Is It.mp3

which is what I would expect.  However using it with 'find' give me 
this type of unexpected result:


for i in `find -E /archive/Multimedia/Audio/Music/Billboard Top USA 
Singles -regex '.*19[6-9][0-9]-0[1-2][0-9].*'`; do basename ${i};done


1980-028
Kenny
Loggins
-
This
Is
It.mp3

Why is this different? And more importantly, how can I capture the 
file name to $i?


It finally occurred to me that I needed the shell to see a new line as 
the delimiter and not whitespace. Then a simple search revealed my answer:


O=$IFS
IFS=$(echo -en \n\b)
do stuff
IFS=$O

Sorry for the noise.

Drew

--
Like card tricks?

Visit The Alchemist's Warehouse to
learn card magic secrets for free!

http://alchemistswarehouse.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Drew Tomlinson

On 8/17/2010 8:22 AM, Chip Camden wrote:

Quoth Drew Tomlinson on Tuesday, 17 August 2010:
   

I have a collection of yearly top 100 Billboard mp3s in this format (all
one line - sorry if it wraps):

/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny
Loggins - This Is It.mp3

I want to create symbolic links to the top 30 in 1966-1969 in another
directory for easy migration to a flash card. Thus I invoked 'find' to
get a list (again, all one line):

find -E /archive/Multimedia/Audio/Music/Billboard Top USA Singles
-regex '.*19[6-9][0-9]-0[0-2][0-9].*'

(OK, I know this will only return the top 29)

'find' returns the complete filename as above:

/archive/Multimedia/Audio/Music/Billboard Top USA Singles/1980-028 Kenny
Loggins - This Is It.mp3

Then I attempt to use 'basename' to extract the file name to a variable
which I can later pass to 'ln'.  This seems to work:

basename /archive/Multimedia/Audio/Music/Billboard Top USA
Singles/1980-028 Kenny Loggins - This Is It.mp3

returns (all one line):

1980-028 Kenny Loggins - This Is It.mp3

which is what I would expect.  However using it with 'find' give me this
type of unexpected result:

for i in `find -E /archive/Multimedia/Audio/Music/Billboard Top USA
Singles -regex '.*19[6-9][0-9]-0[1-2][0-9].*'`; do basename ${i};done

1980-028
Kenny
Loggins
-
This
Is
It.mp3

Why is this different? And more importantly, how can I capture the file
name to $i?
 

Try:

find -E ... | while read i; do; basename $i; done

When using back-ticks, all the output gets appended together,
space-separated.  Then 'for' can't tell the difference between a space in
a filename and a delimiter.  Using 'read' instead preserves line
boundaries.


Thanks for your reply.  I like this better than manipulating $IFS 
because then I don't have to set it back.


Cheers,

Drew

--
Like card tricks?

Visit The Alchemist's Warehouse to
learn card magic secrets for free!

http://alchemistswarehouse.com

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Timm Wimmers
Am Dienstag, den 17.08.2010, 08:22 -0700 schrieb Chip Camden:
 find -E ... | while read i; do; basename $i; done

The semicolon behind do isn't necessary.

-- 
Timm

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Bash Script Help - File Names With Spaces

2010-08-17 Thread Karl Vogel
 On Tue, 17 Aug 2010 07:47:25 -0700, 
 Drew Tomlinson d...@mykitchentable.net said:

D Then I attempt to use 'basename' to extract the file name to a variable
D which I can later pass to 'ln'.  This seems to work:
D   basename /archive/Multimedia/Audio/Music/Billboard Top USA
D   Singles/1980-028 Kenny Loggins - This Is It.mp3

   This is a subset of a larger problem: getting the last field from a set
   of delimited records which may not all have the same number of fields.

   I've used this when I needed basenames for ~500,000 files:
 find . regex-or-print-or-whatever | rev | cut -f1 -d/ | rev

   For dirnames:
 find . regex-or-print-or-whatever | rev | cut -f2- -d/ | rev | sort -u

-- 
Karl Vogel  I don't speak for the USAF or my company

When I'm feeling down, I like to whistle.  It makes the
neighbor's dog run to the end of his chain and gag himself.--unknown
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Bash Script Help - File Names With Spaces -- SOLVED

2010-08-17 Thread Anonymous
Drew Tomlinson d...@mykitchentable.net writes:

 It finally occurred to me that I needed the shell to see a new line as
 the delimiter and not whitespace. Then a simple search revealed my
 answer:

 O=$IFS
 IFS=$(echo -en \n\b)
 do stuff
 IFS=$O

Old IFS value can be preserved by using `local' keyword or (...) braces, too.
It's a bit better than polluting global scope with temporary variable.

  $ echo -n $IFS | (vis -w; echo)
  \040\^I\^J

  $ for i in $(find . -type f); do echo $i; done
  ./My
  Long
  File
  Name
  ./Another
  File

  $ f() { local IFS=; eval $@; }
  $ f 'for i in $(find . -type f); do echo $i; done'
  ./My Long File Name
  ./Another File

  $ (IFS=; for i in $(find . -type f); do echo $i; done)
  ./My Long File Name
  ./Another File

  $ echo -n $IFS | (vis -w; echo)
  \040\^I\^J
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


/etc/fstab + embedded spaces

2009-11-03 Thread carmel_ny
I was attempting to create this entry in the /etc/fstab file. It is to
a WinXP machine.

//u...@bios/My Documents /laptop smbfs rw,noauto  0  0

It fails because 'fstab' does not allow embedded spaces in device
names, not does it allow enclosing the name in quotes.

I did some Googling and discovered that I am not the only one annoyed
by this behavior. I discovered this patch that had been submitted awhile
ago.

http://lists.freebsd.org/pipermail/freebsd-bugs/2007-October/026469.html

Changing the share name is not really an option. Is there some way of
making this work in 'fstab'? I can use the name including spaces in
'mount_smbfs' so that is how I am currently mounting the share. It just
seems strange that 'fstab' by not accepting the use of quoting is not in
step with how FreeBSD usually operates.

-- 

Carmel
carmel...@hotmail.com

|===
|===
|===
|===
|

It is much easier to suggest solutions
when you know nothing about the problem.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread Michael Powell
carmel_ny wrote:

 I was attempting to create this entry in the /etc/fstab file. It is to
 a WinXP machine.
 
 //u...@bios/My Documents /laptop smbfs rw,noauto  0  0
 
 It fails because 'fstab' does not allow embedded spaces in device
 names, not does it allow enclosing the name in quotes.
 
 I did some Googling and discovered that I am not the only one annoyed
 by this behavior. I discovered this patch that had been submitted awhile
 ago.
 
 http://lists.freebsd.org/pipermail/freebsd-bugs/2007-October/026469.html
 
 Changing the share name is not really an option. Is there some way of
 making this work in 'fstab'? I can use the name including spaces in
 'mount_smbfs' so that is how I am currently mounting the share. It just
 seems strange that 'fstab' by not accepting the use of quoting is not in
 step with how FreeBSD usually operates.
 

Don't know if this works for fstab, but the normal way to escape spaces is 
with a \, like this:

//u...@bios/My\ Documents /laptop smbfs rw,noauto  0  0

May not work in fstab but you can try it and see.

-Mike


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread andrew clarke
On Tue 2009-11-03 06:57:12 UTC-0500, carmel_ny (carmel...@hotmail.com) wrote:

 I was attempting to create this entry in the /etc/fstab file. It is to
 a WinXP machine.
 
 //u...@bios/My Documents /laptop smbfs rw,noauto  0  0
 
 It fails because 'fstab' does not allow embedded spaces in device
 names, not does it allow enclosing the name in quotes.

A workaround may be to run mount_smbfs from /etc/crontab (or perhaps
the root user's crontab), eg.

@reboot /usr/sbin/mount_smbfs -N //u...@bios/My Documents /laptop

or similar.

Regards
Andrew
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread Jerry
On Tue, 03 Nov 2009 12:13:24 -0500
Michael Powell nightre...@hotmail.com replied:

carmel_ny wrote:

 I was attempting to create this entry in the /etc/fstab file. It is
 to a WinXP machine.
 
 //u...@bios/My Documents /laptop smbfs rw,noauto  0  0
 
 It fails because 'fstab' does not allow embedded spaces in device
 names, not does it allow enclosing the name in quotes.
 
 I did some Googling and discovered that I am not the only one annoyed
 by this behavior. I discovered this patch that had been submitted
 awhile ago.
 
 http://lists.freebsd.org/pipermail/freebsd-bugs/2007-October/026469.html
 
 Changing the share name is not really an option. Is there some way of
 making this work in 'fstab'? I can use the name including spaces in
 'mount_smbfs' so that is how I am currently mounting the share. It
 just seems strange that 'fstab' by not accepting the use of quoting
 is not in step with how FreeBSD usually operates.
 

Don't know if this works for fstab, but the normal way to escape
spaces is with a \, like this:

//u...@bios/My\ Documents /laptop smbfs rw,noauto  0  0

May not work in fstab but you can try it and see.

Thanks for the suggestion. Unfortunately, it doesn't work either.

-- 
Jerry
ges...@yahoo.com

|===
|===
|===
|===
|

The most winning woman I ever knew was hanged for poisoning three little
children for their insurance money.

Sherlock Holmes

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread andrew clarke
On Tue 2009-11-03 14:07:37 UTC-0600, Adam Vande More (amvandem...@gmail.com) 
wrote:

windows path's have alternate eg c:\Test~1

Yes, files and paths may all have an MS-DOS 8.3 equivalent (I think
this option can be disabled in NTFS), however Windows SMB shares do
not.

\\host\My Documents is valid, but not \\host\MYDOCU~1.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread Adam Vande More
On Tue, Nov 3, 2009 at 2:20 PM, andrew clarke m...@ozzmosis.com wrote:

 On Tue 2009-11-03 14:07:37 UTC-0600, Adam Vande More (
 amvandem...@gmail.com) wrote:

 windows path's have alternate eg c:\Test~1

 Yes, files and paths may all have an MS-DOS 8.3 equivalent (I think
 this option can be disabled in NTFS), however Windows SMB shares do
 not.

 \\host\My Documents is valid, but not \\host\MYDOCU~1.


google also say use \040 in place of space


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: /etc/fstab + embedded spaces

2009-11-03 Thread Adam Vande More
On Tue, Nov 3, 2009 at 2:02 PM, andrew clarke m...@ozzmosis.com wrote:

 On Tue 2009-11-03 06:57:12 UTC-0500, carmel_ny (carmel...@hotmail.com)
 wrote:

  I was attempting to create this entry in the /etc/fstab file. It is to
  a WinXP machine.
 
  //u...@bios/My Documents /laptop smbfs rw,noauto  0  0
 
  It fails because 'fstab' does not allow embedded spaces in device
  names, not does it allow enclosing the name in quotes.

 A workaround may be to run mount_smbfs from /etc/crontab (or perhaps
 the root user's crontab), eg.

 @reboot /usr/sbin/mount_smbfs -N //u...@bios/My Documents
 /laptop

 or similar.

 Regards
 Andrew
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to 
 freebsd-questions-unsubscr...@freebsd.org


windows path's have alternate eg c:\Test~1


-- 
Adam Vande More
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


FTP Server for individual client spaces

2009-07-10 Thread RS Wood
I run a small engineering company* that exchanges large files (CAD,
etc.) with clients, and I want to keep the docs off my email server by
setting up a stand alone FTP server where each client can upload and
download its relevant files.  As such, my own users/employees should be
able to reach every client’s FTP space but each client should only be
able to reach his own.  As my users finish a doc, they place it in that
client’s FTP directory and the client can log in and get it.  As such,
I don’t want any form of unauthenticated FTP.

I’ve tried different combinations of group names and directory
permissions without success, but chrooting users doesn’t seem to solve
my problem either, and my two favorite BSD books – Tiemann et. al.
(Unleashed) and Lucas (Absolute) take the same approach the man pages
do, in my opinion, which guides you either into an all anonymous system,
or a system suitable for organizations such as software distributors in
which clients/users authenticate but then all access the same directory
(/pub for example).  I could use some help conceptualizing this.

Is the solution ftpchroot?  If so, it’s not clear how I can chroot
each potential client into his own directory, as my understanding is
that all chrooted users wind up at the same place (like /var/ftp/pub). 
Or is the solution that each client gets access to his own home
directory; if so, how do I ensure my staff has access to each client’s
home directory?  Lastly, I’ve also been reading up on PureFTP, which
seems to have some advanced configuration potential (including LDAP
authentication, something else that interests me) but it’s not clear
that using an alternative product is indicated here.
This seems like something other organizations must have dealt with, so I
must be missing something fundamental.  Can someone point me in the
right direction?

Finally, I’m aware FTP has inherent security liabilities as passwords
cross the net in clear text, but I’m not convinced casual users on
Windows boxes will be able to manage fun stuff like SSH connections or
alternative software, like SCP.  In my experience, the “modern”
windows user accesses FTP sites using Internet Explorer, which is
tremendously underwhelming.  As such I am choosing a stand alone box on
which no other services are running (mail, X, etc.).  Am I right?  Or is
there some better method that won’t be too complex for the casual
Windows user?

Thanks advance for the pointers.

Randy
--
www.therandymon.com

*Actually, this is all hypothetical, but I’m learning server admin so
I can cross this bridge when the time comes, and having a lot of fun,
naturally, since right now my screw ups don’t count!
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FTP Server for individual client spaces

2009-07-10 Thread Jonathan McKeown
On Friday 10 July 2009 16:10:24 RS Wood wrote:
 I run a small engineering company* that exchanges large files (CAD,
 etc.) with clients, and I want to keep the docs off my email server by
 setting up a stand alone FTP server where each client can upload and
 download its relevant files.  As such, my own users/employees should be
 able to reach every client’s FTP space but each client should only be
 able to reach his own.  As my users finish a doc, they place it in that
 client’s FTP directory and the client can log in and get it.  As such,
 I don’t want any form of unauthenticated FTP.
[snip]
 Is the solution ftpchroot?  If so, it’s not clear how I can chroot
 each potential client into his own directory, as my understanding is
 that all chrooted users wind up at the same place (like /var/ftp/pub).
 Or is the solution that each client gets access to his own home
 directory; if so, how do I ensure my staff has access to each client’s
 home directory?

I haven't tried this, but man ftpd.conf suggests something along the lines of:

chroot chroot /some/path/%u

where the second chroot is the ftp class, and %u will be expanded to the 
username. Make sure all your external users are in ftp class chroot (by 
putting their usernames in /etc/ftpchroot), and make /some/path group-owned 
and group-readable by a group all your staff are in (the group ownership of a 
directory automatically propagates to new directories created below it).

Let us know how it goes!

Jonathan
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FTP Server for individual client spaces

2009-07-10 Thread Steve Bertrand
RS Wood wrote:
 I run a small engineering company* that exchanges large files (CAD,
 etc.) with clients, and I want to keep the docs off my email server by
 setting up a stand alone FTP server where each client can upload and
 download its relevant files.  As such, my own users/employees should be
 able to reach every client’s FTP space but each client should only be
 able to reach his own.  As my users finish a doc, they place it in that
 client’s FTP directory and the client can log in and get it.  As such,
 I don’t want any form of unauthenticated FTP.
 
 I’ve tried different combinations of group names and directory
 permissions without success, but chrooting users doesn’t seem to solve
 my problem either, and my two favorite BSD books – Tiemann et. al.
 (Unleashed) and Lucas (Absolute) take the same approach the man pages
 do, in my opinion, which guides you either into an all anonymous system,
 or a system suitable for organizations such as software distributors in
 which clients/users authenticate but then all access the same directory
 (/pub for example).  I could use some help conceptualizing this.
 
 Is the solution ftpchroot?  

It works for us, for the users who still need FTP access:

# cp /sbin/nologin /sbin/ftp-only
# echo /sbin/ftp-only  /etc/shells

# adduser

homedir == /ftp/username
shell   == /sbin/ftp-only

I then:

# cd /ftp/username
# rm -r .*

# echo username  /etc/ftpchroot

Now, you can create staff accounts in the same way, but set their home
directory as /ftp. They'll be able to traverse the entire FTP tree from
there. Just ensure that the /ftp directory structure is owned by a group
that your staff accounts are in, and that all of the sub directories are
modded with appropriate permissions.

 If so, it’s not clear how I can chroot
 each potential client into his own directory, as my understanding is
 that all chrooted users wind up at the same place (like /var/ftp/pub). 
 Or is the solution that each client gets access to his own home
 directory; 

Yes, each to their own home dir.

 if so, how do I ensure my staff has access to each client’s
 home directory?  

I'm assuming that your staff will be using FTP as well. Simply assign
their home directory to the root FTP directory.

 Lastly, I’ve also been reading up on PureFTP, which
 seems to have some advanced configuration potential (including LDAP
 authentication, something else that interests me) but it’s not clear
 that using an alternative product is indicated here.
 This seems like something other organizations must have dealt with, so I
 must be missing something fundamental.  Can someone point me in the
 right direction?
 
 Finally, I’m aware FTP has inherent security liabilities as passwords
 cross the net in clear text, but I’m not convinced casual users on
 Windows boxes will be able to manage fun stuff like SSH connections or
 alternative software, like SCP.  

Provide them a link to a client software that uses SFTP. I use WinSCP
(portable), which defaults to SFTP, and provides the server, username
and password fields as soon as it is launched.

Hope I didn't miss anything ;)

Steve



smime.p7s
Description: S/MIME Cryptographic Signature


Re: FTP Server for individual client spaces

2009-07-10 Thread Dan Nelson
In the last episode (Jul 10), Steve Bertrand said:
 RS Wood wrote:
  Finally, I'm aware FTP has inherent security liabilities as passwords
  cross the net in clear text, but I'm not convinced casual users on
  Windows boxes will be able to manage fun stuff like SSH connections or
  alternative software, like SCP.
 
 Provide them a link to a client software that uses SFTP. I use WinSCP
 (portable), which defaults to SFTP, and provides the server, username and
 password fields as soon as it is launched.

WinSCP is good.  Other nice free SFTP clients are FileZilla (has Windows, OS
X and Unix versions) and muCommander (Java so it will run on anything).

http://www.winscp.net/
http://www.filezilla-project.org/
http://www.mucommander.com/

-- 
Dan Nelson
dnel...@allantgroup.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FTP Server for individual client spaces

2009-07-10 Thread Ruben de Groot
On Fri, Jul 10, 2009 at 03:10:24PM +0100, RS Wood typed:
 I run a small engineering company* that exchanges large files (CAD,
 etc.) with clients, and I want to keep the docs off my email server by
 setting up a stand alone FTP server where each client can upload and
 download its relevant files.  As such, my own users/employees should be
 able to reach every client???s FTP space but each client should only be
 able to reach his own.  As my users finish a doc, they place it in that
 client???s FTP directory and the client can log in and get it.  As such,
 I don???t want any form of unauthenticated FTP.

Do your employees need access through the same ftp server?
You could serve them any other way (e.g. internally export the entire ftp
tree as an NFS or CIFS share).

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Yuri
I can't find any references in rc.conf(5) on how to set up ifconfig line 
if SSID has spaces which is very typical situation.
ifconfig(8) doesn't mention this either but it works if I put quotes 
around it.


I would assume spaces should be substituted for '_' like in Linux. But I 
remember I wasn't able to make it work for some reason.


Yuri

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Glen Barber
On Thu, Jun 11, 2009 at 3:29 PM, Yuriy...@rawbw.com wrote:
 I can't find any references in rc.conf(5) on how to set up ifconfig line if
 SSID has spaces which is very typical situation.
 ifconfig(8) doesn't mention this either but it works if I put quotes around
 it.

 I would assume spaces should be substituted for '_' like in Linux. But I
 remember I wasn't able to make it work for some reason.


Did you try escaping it?

My\ SSID\ Has\ Spaces

-- 
Glen Barber
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Mel Flynn
On Thursday 11 June 2009 11:29:25 Yuri wrote:
 I can't find any references in rc.conf(5) on how to set up ifconfig line
 if SSID has spaces which is very typical situation.
 ifconfig(8) doesn't mention this either but it works if I put quotes
 around it.

So escape use and escape the quotes with a backslash. You may need more then 
one backslash, depending on the level of evaluation in /etc/rc.subr and 
/etc/rc.d/netif.

 I would assume spaces should be substituted for '_' like in Linux. But I
 remember I wasn't able to make it work for some reason.

The reason probably being that underscores are different characters from 
spaces and FreeBSD not making assumptions on things really being other things.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Yuri

Mel Flynn wrote:


So escape use and escape the quotes with a backslash. You may need more then 
one backslash, depending on the level of evaluation in /etc/rc.subr and 
/etc/rc.d/netif.
  


I believe documentation should describe this since this is a major 
element of setting wireless network up.

If that's more than one backslash that's bad since it makes it cryptic.
I will investigate and will file a PR with patch.

Yuri

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Mel Flynn
On Thursday 11 June 2009 11:55:15 Mel Flynn wrote:
 On Thursday 11 June 2009 11:29:25 Yuri wrote:
  I can't find any references in rc.conf(5) on how to set up ifconfig line
  if SSID has spaces which is very typical situation.
  ifconfig(8) doesn't mention this either but it works if I put quotes
  around it.

 So escape use
strike that escape.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: rc.conf when ssid has spaces in it: missing documentation or missing feature?

2009-06-11 Thread Mel Flynn
On Thursday 11 June 2009 12:03:56 Yuri wrote:
 Mel Flynn wrote:
  So escape use and escape the quotes with a backslash. You may need more
  then one backslash, depending on the level of evaluation in /etc/rc.subr
  and /etc/rc.d/netif.

 I believe documentation should describe this since this is a major
 element of setting wireless network up.

Perhaps.

 If that's more than one backslash that's bad since it makes it cryptic.
 I will investigate and will file a PR with patch.

Knowledge of how sh treats variables is assumed for any unix admin. The level 
of escaping might be cryptic to some, but using sh -x /etc/rc./netif start 
ifname one can easily trace how the ifconfig_ifname variable is evaluated 
and where the backslashes are consumed.
-- 
Mel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Spaces in SSID in /etc/rc.conf

2007-09-22 Thread ronggui
I come across the same problem. and my solution is to use hex instead
of normal string.

man ifconfig, you will see:

ssid ssid
 Set the desired Service Set Identifier (aka network name).  The
 SSID is a string up to 32 characters in length and may be speci-
 fied as either a normal string or in hexadecimal when preceded by
 `0x'.  Additionally, the SSID may be cleared by setting it to
 `-'.

If you add the following line to /etc/rc.conf, It will works.

ifconfig_ath0 = DHCP ssid 0x6d79206e6574776f726b


Hope it helps.

2007/5/20, Gunther Mayer [EMAIL PROTECTED]:
 Christopher Cowart wrote:
  On Mon, May 14, 2007 at 09:45:48PM +0200, Gunther Mayer wrote:
 
  Hi there,
 
  I got a low key server who is wirelessly connected to the net using an
  SSID that contains a space. In rc.conf I define the ifconfig line for
  configuration of my wireless interface upon bootup, but the entire line
  reads something like
 
  ifconfig_ath0=' inet 192.168.0.1 ssid my network '
 
  No matter how I tweak the quotes (single then double, other way round,
  with lots of \\) I never get my interface to configure properly upon
  bootup and I need to get to the console to fix it up. I thought I knew
  shell syntax but this is beyond me or manpages...
 
  What's the right way to do this?
 
 
  One approach would be to navigate the series of function calls defined
  in /etc/network.subr. I just took a brief look, but it's not immediately
  obvious how many times you're going to have to escape exactly what to
  get the behavior you desire.
 
  Another option would be to make the file /etc/start_if.ath0, containing
  the line `ifconfig ... ssid my network`. This file would be sourced
  when /etc/rc.d/netif starts the network interfaces, before the rc
  variable ifconfig_ath0 is run. You can then omit the variable
  ifconfig_ath0 from /etc/rc.conf.
 
  For more hints, look in /etc/netif, /etc/network.subr, and /etc/rc.subr.
 
 Thanks for all your ideas guys, I really appreciate the help. Finally
 got some time to try all of your suggestions, though backwhacking (\)
 the space and/or the quotes makes no difference so I decided in the end
 to stop fighting the quoting wars and to just use /etc/start_if.ath0
 which works perfectly. Not quite as neat as having everything live in
 /etc/rc.conf but it does the trick.
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]



-- 
Ronggui Huang

Department of Sociology, Fudan University, Shanghai, China

Department of Public and Social Administration, CityU, HK
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Spaces in SSID in /etc/rc.conf

2007-05-19 Thread Gunther Mayer

Christopher Cowart wrote:

On Mon, May 14, 2007 at 09:45:48PM +0200, Gunther Mayer wrote:
  

Hi there,

I got a low key server who is wirelessly connected to the net using an 
SSID that contains a space. In rc.conf I define the ifconfig line for 
configuration of my wireless interface upon bootup, but the entire line 
reads something like


ifconfig_ath0=' inet 192.168.0.1 ssid my network '

No matter how I tweak the quotes (single then double, other way round, 
with lots of \\) I never get my interface to configure properly upon 
bootup and I need to get to the console to fix it up. I thought I knew 
shell syntax but this is beyond me or manpages...


What's the right way to do this?



One approach would be to navigate the series of function calls defined
in /etc/network.subr. I just took a brief look, but it's not immediately
obvious how many times you're going to have to escape exactly what to
get the behavior you desire.

Another option would be to make the file /etc/start_if.ath0, containing
the line `ifconfig ... ssid my network`. This file would be sourced
when /etc/rc.d/netif starts the network interfaces, before the rc
variable ifconfig_ath0 is run. You can then omit the variable
ifconfig_ath0 from /etc/rc.conf.

For more hints, look in /etc/netif, /etc/network.subr, and /etc/rc.subr.
  
Thanks for all your ideas guys, I really appreciate the help. Finally 
got some time to try all of your suggestions, though backwhacking (\) 
the space and/or the quotes makes no difference so I decided in the end 
to stop fighting the quoting wars and to just use /etc/start_if.ath0 
which works perfectly. Not quite as neat as having everything live in 
/etc/rc.conf but it does the trick.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Spaces in SSID in /etc/rc.conf

2007-05-15 Thread Erik Norgaard

Gunther Mayer wrote:

Hi there,

I got a low key server who is wirelessly connected to the net using an 
SSID that contains a space. In rc.conf I define the ifconfig line for 
configuration of my wireless interface upon bootup, but the entire line 
reads something like


ifconfig_ath0=' inet 192.168.0.1 ssid my network '

No matter how I tweak the quotes (single then double, other way round, 
with lots of \\) I never get my interface to configure properly upon 
bootup and I need to get to the console to fix it up. I thought I knew 
shell syntax but this is beyond me or manpages...


What's the right way to do this?


I think the right way is to use wpa_supplicant.conf to define wireless 
networks. Then in your rc.conf you prefix the NIC configuration with WPA 
like this:


ifconfig_ath0==WPA DHCP

This method also allows you to define various wireless networks if needed.

Cheers, Erik

--
Ph: +34.666334818  web: http://www.locolomo.org


smime.p7s
Description: S/MIME Cryptographic Signature


Spaces in SSID in /etc/rc.conf

2007-05-14 Thread Gunther Mayer

Hi there,

I got a low key server who is wirelessly connected to the net using an 
SSID that contains a space. In rc.conf I define the ifconfig line for 
configuration of my wireless interface upon bootup, but the entire line 
reads something like


ifconfig_ath0=' inet 192.168.0.1 ssid my network '

No matter how I tweak the quotes (single then double, other way round, 
with lots of \\) I never get my interface to configure properly upon 
bootup and I need to get to the console to fix it up. I thought I knew 
shell syntax but this is beyond me or manpages...


What's the right way to do this?

Gunther
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Spaces in SSID in /etc/rc.conf

2007-05-14 Thread Christopher Cowart
On Mon, May 14, 2007 at 09:45:48PM +0200, Gunther Mayer wrote:
 Hi there,
 
 I got a low key server who is wirelessly connected to the net using an 
 SSID that contains a space. In rc.conf I define the ifconfig line for 
 configuration of my wireless interface upon bootup, but the entire line 
 reads something like
 
 ifconfig_ath0=' inet 192.168.0.1 ssid my network '
 
 No matter how I tweak the quotes (single then double, other way round, 
 with lots of \\) I never get my interface to configure properly upon 
 bootup and I need to get to the console to fix it up. I thought I knew 
 shell syntax but this is beyond me or manpages...
 
 What's the right way to do this?

One approach would be to navigate the series of function calls defined
in /etc/network.subr. I just took a brief look, but it's not immediately
obvious how many times you're going to have to escape exactly what to
get the behavior you desire.

Another option would be to make the file /etc/start_if.ath0, containing
the line `ifconfig ... ssid my network`. This file would be sourced
when /etc/rc.d/netif starts the network interfaces, before the rc
variable ifconfig_ath0 is run. You can then omit the variable
ifconfig_ath0 from /etc/rc.conf.

For more hints, look in /etc/netif, /etc/network.subr, and /etc/rc.subr.

-- 
Chris Cowart
Lead Systems Administrator
Network Infrastructure, RSSP-IT
UC Berkeley


signature.asc
Description: Digital signature


RE: Spaces in SSID in /etc/rc.conf

2007-05-14 Thread Murray Taylor
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Gunther Mayer
 Sent: Tuesday, 15 May 2007 5:46 AM
 To: freebsd-questions@freebsd.org
 Subject: Spaces in SSID in /etc/rc.conf
 
 Hi there,
 
 I got a low key server who is wirelessly connected to the net 
 using an 
 SSID that contains a space. In rc.conf I define the ifconfig line for 
 configuration of my wireless interface upon bootup, but the 
 entire line 
 reads something like
 
 ifconfig_ath0=' inet 192.168.0.1 ssid my network '
 
 No matter how I tweak the quotes (single then double, other 
 way round, 
 with lots of \\) I never get my interface to configure properly upon 
 bootup and I need to get to the console to fix it up. I 
 thought I knew 
 shell syntax but this is beyond me or manpages...
 
 What's the right way to do this?
 
 Gunther

Have you tried this (I havent, its just a suggestion)...

I use this construct to get around scp transfers and the
file names windoze users love to create with heaps of spaces...


ifconfig_ath0=' inet 192.168.0.1 ssid my\ network '


If there are multiple spaces then you need to slash each one, i.e.

 ifconfig_ath0=' inet 192.168.0.1 ssid my\ \ network '

Give it a shot ;-)

mjt
---
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material. 

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---

### This e-mail message has been scanned for Viruses by Bytecraft ###
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Spaces in SSID in /etc/rc.conf

2007-05-14 Thread Bill Campbell
On Tue, May 15, 2007, Murray Taylor wrote:

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of 
 Gunther Mayer
 Sent: Tuesday, 15 May 2007 5:46 AM
 To: freebsd-questions@freebsd.org
 Subject: Spaces in SSID in /etc/rc.conf
 
 Hi there,
 
 I got a low key server who is wirelessly connected to the net 
 using an 
 SSID that contains a space. In rc.conf I define the ifconfig line for 
 configuration of my wireless interface upon bootup, but the 
 entire line 
 reads something like
 
 ifconfig_ath0=' inet 192.168.0.1 ssid my network '
 
 No matter how I tweak the quotes (single then double, other 
 way round, 
 with lots of \\) I never get my interface to configure properly upon 
 bootup and I need to get to the console to fix it up. I 
 thought I knew 
 shell syntax but this is beyond me or manpages...
 
 What's the right way to do this?
 
 Gunther

Have you tried this (I havent, its just a suggestion)...

I use this construct to get around scp transfers and the
file names windoze users love to create with heaps of spaces...

I would look at the code that uses this as often this type of
problems results from multiple expansions of an expression.

In this case the variable ifconfig_ath0 is set to
``inet 192.168.0.1 ssid my network'', but that may well be used
in an `eval` or some such resulting in multple expansions.

Backwhacking the double quotes might help:

ifconfig_ath0='inet 192.168.0.1 ssid \my network\'

One could always cheat and create a simple script to execute
instead of trying to fight the quoting wars.

ifconfig_ath0='/usr/local/bin/mynetwork.sh'

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

``Never do your enemy a minor injury.''
- Machiavelli
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Bluetooth - obexapp - get/put files with spaces in names

2006-02-20 Thread dgmm
On Sunday 19 February 2006 13:58, Michal F. Hanula wrote:
 On Sun, Feb 19, 2006 at 01:25:28AM +, dgmm wrote:
  After some fiddling and hair pulling I eventually got my bluetooth
  adapter to see the mobile phone.
 
  I'd like to pull some files from it but either I'm not seeing the obvious
  or it just ain't obvious.
 
  Does anyone know how to change to a directory which has spaces in the
  name or get a file which has spaces in the name?

 $ obexapp -a siemens -c -C ftrn -f
 obex ls
 Access    Owner    Group    Size       Modified         Name
 RWD  W    n/a      n/a      n/a        01-Jan-04 00:00  Data/
 RWD  W    n/a      n/a      n/a        15-Jan-04 00:00  MMCard/
 Success, response: OK, Success (0x20)
 obex cd Data
 Success, response: OK, Success (0x20)
 obex ls
 Access    Owner    Group    Size       Modified         Name
  WD  W    n/a      n/a      n/a        01-Apr-04 03:00  System/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Misc/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Animations/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Pictures/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Sounds/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Themes/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Videos/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:00  Java/
 RWD  W    n/a      n/a      n/a        01-Apr-04 03:07  Skins/
 RWD  W    n/a      n/a      n/a        01-Apr-04 05:00  Voice memo/
 RWD  W    n/a      n/a      n/a        21-Oct-05 21:11  Sms
 archive/ RWD  W    n/a      n/a      n/a        19-Feb-06 14:55  Video
 clips/ Success, response: OK, Success (0x20)
 obex cd
 cd: remote directory Video clips
 Success, response: OK, Success (0x20)
 obex

 Not really intuitive.

Thanks.  That worked :-)

I'm sure I tried that, butI tried a lot of things and sometimes things are 
a little obscure..

Thanks again.

-- 
Dave
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: Bluetooth - obexapp - get/put files with spaces in names

2006-02-19 Thread Michal F. Hanula
On Sun, Feb 19, 2006 at 01:25:28AM +, dgmm wrote:
 After some fiddling and hair pulling I eventually got my bluetooth adapter to 
 see the mobile phone.
 
 I'd like to pull some files from it but either I'm not seeing the obvious or 
 it just ain't obvious.
 
 Does anyone know how to change to a directory which has spaces in the name or 
 get a file which has spaces in the name?
$ obexapp -a siemens -c -C ftrn -f
obex ls
AccessOwnerGroupSize   Modified Name
RWD  Wn/a  n/a  n/a01-Jan-04 00:00  Data/
RWD  Wn/a  n/a  n/a15-Jan-04 00:00  MMCard/
Success, response: OK, Success (0x20)
obex cd Data
Success, response: OK, Success (0x20)
obex ls
AccessOwnerGroupSize   Modified Name
 WD  Wn/a  n/a  n/a01-Apr-04 03:00  System/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Misc/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Animations/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Pictures/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Sounds/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Themes/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Videos/
RWD  Wn/a  n/a  n/a01-Apr-04 03:00  Java/
RWD  Wn/a  n/a  n/a01-Apr-04 03:07  Skins/
RWD  Wn/a  n/a  n/a01-Apr-04 05:00  Voice memo/
RWD  Wn/a  n/a  n/a21-Oct-05 21:11  Sms archive/
RWD  Wn/a  n/a  n/a19-Feb-06 14:55  Video clips/
Success, response: OK, Success (0x20)
obex cd
cd: remote directory Video clips
Success, response: OK, Success (0x20)
obex

Not really intuitive.
mf
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Bluetooth - obexapp - get/put files with spaces in names

2006-02-19 Thread Gerard Seibert
dgmm wrote:

 After some fiddling and hair pulling I eventually got my bluetooth adapter to 
 see the mobile phone.
 
 I'd like to pull some files from it but either I'm not seeing the obvious or 
 it just ain't obvious.
 
 Does anyone know how to change to a directory which has spaces in the name or 
 get a file which has spaces in the name?

I have no idea if this will help you or not; however, you could try
enclosing the directory or file name in quotes. I have used that method
on a few  occasions when accessing a WinXP machine.

-- 
Gerard
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Bluetooth - obexapp - get/put files with spaces in names

2006-02-18 Thread dgmm
After some fiddling and hair pulling I eventually got my bluetooth adapter to 
see the mobile phone.

I'd like to pull some files from it but either I'm not seeing the obvious or 
it just ain't obvious.

Does anyone know how to change to a directory which has spaces in the name or 
get a file which has spaces in the name?


/home/dave %obexapp -c -f -a 00:15:b9:0e:ef:1d -C FTRN
obex ls
AccessOwnerGroupSize   Modified Name
  n/a  n/a  n/an/a  Photos/
  n/a  n/a  n/an/a  DownLoaded Images/
  n/a  n/a  n/an/a  Favorite Images/
  n/a  n/a  n/an/a  Video clips/
  n/a  n/a  n/an/a  DownLoaded Videos/
  n/a  n/a  n/an/a  Favorite Videos/
  n/a  n/a  n/an/a  Music/
  n/a  n/a  n/an/a  Voice list/
  n/a  n/a  n/an/a  Downloaded Sounds/
  n/a  n/a  n/an/a  Favorite Sounds/
  n/a  n/a  n/an/a  Other Files/
Success, response: OK, Success (0x20)
obex cd Video clips
Failure, response: Not found (0x44)
obex cd Video clips
Failure, response: Not found (0x44)
obex cd Video clips/
Failure, response: Not found (0x44)
obex cd Video clips/
Failure, response: Not found (0x44)
obex cd Video\ clips
Failure, response: Not found (0x44)
obex cd 'Video clips'
Failure, response: Not found (0x44)
obex


-- 
Dave
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Problems with filename with spaces (was Pipes and commands thatrequire two arguments)

2004-04-13 Thread Peter Risdon
Thanks very much for the previous help - I missed the example in man xargs.

The files I am trying to manipulate include spaces in the file names, 
and I cannot seem to escape them effectively. If I try something like:

#find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;' | 
xargs -0 -J % mv % /usr/newplace/

Then although all spaces are preceded by backslashes I get errors every 
time a space is encountered. So for a file at /usr/home/user/this is a 
file.rtf.exe I get file does not exist errors from mv at:
/usr/home/user/this\
and at:
is\
and at:
a\
and at:
file.rtf.exe (yes, a windows virus on a network share has been busy).

I have also tried

#find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;'  
listofdodgyfiles

and the list is fine. If I paste a line into mv on the command line, it 
works. If I use a simple script to read the file, same errors as 
mentioned above.

I'm sure I'm missing something obvious... Any nudges in the right 
direction would be gratefully received.

PWR.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Problems with filename with spaces (was Pipes and commands thatrequire two arguments)

2004-04-13 Thread Matthew Seaman
On Tue, Apr 13, 2004 at 11:33:29AM +0100, Peter Risdon wrote:
 Thanks very much for the previous help - I missed the example in man xargs.
 
 The files I am trying to manipulate include spaces in the file names, 
 and I cannot seem to escape them effectively. If I try something like:
 
 #find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;' | 
 xargs -0 -J % mv % /usr/newplace/
 
 Then although all spaces are preceded by backslashes I get errors every 
 time a space is encountered. So for a file at /usr/home/user/this is a 
 file.rtf.exe I get file does not exist errors from mv at:
 /usr/home/user/this\
 and at:
 is\
 and at:
 a\
 and at:
 file.rtf.exe (yes, a windows virus on a network share has been busy).
 
 I have also tried
 
 #find /usr/home -name *.rtf.exe -print0 | perl -p -e 's/\ /\\\ /g;'  
 listofdodgyfiles
 
 and the list is fine. If I paste a line into mv on the command line, it 
 works. If I use a simple script to read the file, same errors as 
 mentioned above.
 
 I'm sure I'm missing something obvious... Any nudges in the right 
 direction would be gratefully received.

Errr... how about:

# find /usr/home -name '*.rtf.exe' -print0 | \
   xargs -0 -J % mv % /usr/newplace/

or

# find /usr/home -name '*.rtf.exe' -print0 | \
perl -n0e '($x = $_) =~ s,^.*/,/usr/newplace/,; rename $_, $x;'

Note: this puts all of those files into a single directory and doesn't
do anything to avoid overwriting one file with another.  I assume
that's what you want.

This sort of thing is the whole point of '-print0' -- it sidesteps all
of the things the shell does with significant characters when it turns
a command line into an argument list.  ie. no escaping needed.

Cheers,

Matthew


-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK


pgp0.pgp
Description: PGP signature


tcsh script: quote and spaces problems

2003-07-31 Thread Rob Lahaye


Hello,

I've been trying to include the quote () characters and spaces into a tcsh script
variable; for already two days I've been trying various ways doing this to no avail!
I'm about to think that it is impossible.
For example:


#!/bin/tcsh
set flag=-f t  

This obviously doesn't work because of too many quotes involved; but what does work
to achieve this? There are two problems here:
  1) flag should contain the two internal quotes of t  
  2) the t   contains two spaces.
When I use
  set flag='-f t  '
the two spaces are automagically (?) reduced to only one space!!

The latter seems to be a general problem:

  set flag=f 

wil result in flag containing only f .

Any solutions for this problem with quotes and spaces in tcsh script?
Or is tcsh not suitable for this kind of things?
Thanks,
Rob.


___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Michael E. Mercer
On Thu, 2003-07-31 at 21:42, Rob Lahaye wrote:
 When I use
set flag='-f t  '
 

When I echo this out, I get what you are wanting...
can you show us how you are using this, to get the weird behavior?

Thanks
MeM

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Chuck Swiger
Rob Lahaye wrote:
[ ... ]
Any solutions for this problem with quotes and spaces in tcsh script?
Or is tcsh not suitable for this kind of things?
Ugh, the latter.  :-)  /bin/sh handles nested quoting right, but crunches the 
space together:

% foo=-f \t  \
% echo $foo
-f t 
% foo='-f t  '
% echo $foo
-f t 
...however, you might be able to muck with $IFS and get better results. Also, 
ZSH seems to do exactly what you expected:

64-sec% foo=-f \t  \
65-sec% echo $foo
-f t  
67-sec% foo='-f t  '
68-sec% echo $foo
-f t  
--
-Chuck
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Michael E. Mercer
ok ok... I noticed one thing while playing with this...

the script hello.sh
#!/bin/tcsh -f

set JUNK='-f t  '

echo ${JUNK}
echo ${JUNK}

The first echo prints it -f t  
and the second -f t 

Can you use it with the double quotes around it?

later
MeM


On Thu, 2003-07-31 at 22:12, Michael E. Mercer wrote:
 On Thu, 2003-07-31 at 21:42, Rob Lahaye wrote:
  When I use
 set flag='-f t  '
  
 
 When I echo this out, I get what you are wanting...
 can you show us how you are using this, to get the weird behavior?
 
 Thanks
 MeM
 
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Dan Nelson
In the last episode (Jul 31), Chuck Swiger said:
 Rob Lahaye wrote:
 [ ... ]
 Any solutions for this problem with quotes and spaces in tcsh
 script? Or is tcsh not suitable for this kind of things?
 
 Ugh, the latter.  :-)  /bin/sh handles nested quoting right, but crunches 
 the space together:
 
 % foo=-f \t  \
 % echo $foo
 -f t 
 
 % foo='-f t  '
 % echo $foo
 -f t 

Actually it doesn't.  You get this result because sh splits variables
on $IFS before passing the result to a command, so what echo gets is
 argv[1]=-f \t
 argv[2]=\
, and echo always prints its arguments separated by a space.  You can
verify that the variable is set correctly by running set | grep -a
foo.  To pass the entire string as one argument, run echo $foo.

 ...however, you might be able to muck with $IFS and get better results. 
 Also, ZSH seems to do exactly what you expected:
 
 64-sec% foo=-f \t  \
 65-sec% echo $foo
 -f t  

This is because zsh passes variables directly to commands, unless the
SH_WORD_SPLIT flag is set.  You can force spltting with the ${=foo}
syntax.

-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Rob Lahaye

Dan Nelson wrote:
 
 Actually it doesn't.  You get this result because sh splits variables
 on $IFS before passing the result to a command, so what echo gets is
  argv[1]=-f \t
  argv[2]=\

I come to the conclusion that there's no intuitive solution in a
tcsh script for

   set foo='-f a  '

My unix knowledge tells me the following should work:

   set foo=-f\ \a\ \ \

but tcsh does not allow these escape sequences; the backslashes
become real backslashes and an error occurs on too many
quotes.

Another odd behaviour occurs when I say:

  set foo=abc

which tcsh reduces to a b c, despite the quotes.


I'd say very un-unix like behaviours

Rob.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: tcsh script: quote and spaces problems

2003-07-31 Thread Dan Nelson
In the last episode (Aug 01), Rob Lahaye said:
 Another odd behaviour occurs when I say:
 
   set foo=abc
 
 which tcsh reduces to a b c, despite the quotes.

This works for me (-CURRENT).

$ tcsh
dan: {3001} set foo=abc
dan: {3002} set | grep foo
_   set foo=abc
foo abc
dan: {3003} echo $foo
abc
dan: {3004} 
 
-- 
Dan Nelson
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mounting Win with spaces via samba in fstab

2003-06-11 Thread John DeStefano
I'm afraid you may be right, Matt.
I found the following in man fstab 5:
If a program needs the character special file name, the pro-
 gram must create it by appending a ``r'' after the last ``/'' in the spe-
 cial file name.
...but that didn't seem to help.
The mount_smbfs command seems to work fine with the \  sequence, but this isn't the 
case with fstab.
Perhaps if I were instead to include mount_smbfs commands in a script to be run at 
boot time:
#!/bin/sh 
mount_smbfs //[EMAIL PROTECTED]/Win\ Partition /mountpoint 
 
Is this the proper syntax for a script?  And if so, where would I put such a file?
Thank you,
~John


Matthew Emmerton [EMAIL PROTECTED] wrote: I'm trying to mount a remote Windows 
directory, which happens to have a
space in its name; mount -a returns the following error:
 fstab: /etc/fstab:14: Inappropriate file type or format

 I have tried both of the following formats:
 //[EMAIL PROTECTED]/Win\ Partition /mountpoint smbfs rw 0 0
 //[EMAIL PROTECTED]/Win Partition /mountpoint smbfs rw 0 0

 I pulled this format directly from man mount_smbfs 8:
 //[EMAIL PROTECTED]/public /smb/public smbfs rw,noauto 0 0

 I searched the archives, and it seems this question had been asked once
before, but no conclusion was reached:

http://groups.google.com/groups?hl=enlr=lang_enie=UTF-8threadm=1042037002.72844.6.camel%40d80h149.public.uconn.edu.lucky.freebsd.questionsrnum=1prev=/groups%3Fq%3D%2522fstab:%2B/etc/fstab%2522%2B%2522Inappropriate%2Bfile%2Btype%2Bor%2Bformat%2522%2Bsmbfs%26hl%3Den%26lr%3Dlang_en%26ie%3DUTF-8%26selm%3D1042037002.72844.6.camel%2540d80h149.public.uconn.edu.lucky.freebsd.questions%26rnum%3D1

I think the problem is that the fstab(5) file format treats spaces as field
delimiters, and the routines used to parse fstab
(/usr/src/lib/libc/gen/fstab.c, fstabscan() in particular) do not know how
to handle escaped spaces nor quoted fields.

--
Matt Emmerton



-
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: mounting Win with spaces via samba in fstab

2003-06-11 Thread Matthew Emmerton
[top-posting corrected]

 Matthew Emmerton [EMAIL PROTECTED] wrote: I'm trying to mount a remote
Windows directory, which happens to have a
 space in its name; mount -a returns the following error:
  fstab: /etc/fstab:14: Inappropriate file type or format
 
  I have tried both of the following formats:
  //[EMAIL PROTECTED]/Win\ Partition /mountpoint smbfs rw 0 0
  //[EMAIL PROTECTED]/Win Partition /mountpoint smbfs rw 0 0
 
  I pulled this format directly from man mount_smbfs 8:
  //[EMAIL PROTECTED]/public /smb/public smbfs rw,noauto 0 0
 
  I searched the archives, and it seems this question had been asked once
 before, but no conclusion was reached:
 

http://groups.google.com/groups?hl=enlr=lang_enie=UTF-8threadm=1042037002.72844.6.camel%40d80h149.public.uconn.edu.lucky.freebsd.questionsrnum=1prev=/groups%3Fq%3D%2522fstab:%2B/etc/fstab%2522%2B%2522Inappropriate%2Bfile%2Btype%2Bor%2Bformat%2522%2Bsmbfs%26hl%3Den%26lr%3Dlang_en%26ie%3DUTF-8%26selm%3D1042037002.72844.6.camel%2540d80h149.public.uconn.edu.lucky.freebsd.questions%26rnum%3D1

 I think the problem is that the fstab(5) file format treats spaces as
field
 delimiters, and the routines used to parse fstab
 (/usr/src/lib/libc/gen/fstab.c, fstabscan() in particular) do not know how
 to handle escaped spaces nor quoted fields.

 --
 Matt Emmerton

 I'm afraid you may be right, Matt.
 I found the following in man fstab 5:
 If a program needs the character special file name, the pro-
  gram must create it by appending a ``r'' after the last ``/'' in the
spe-
  cial file name.
 ...but that didn't seem to help.
 The mount_smbfs command seems to work fine with the \  sequence, but
this isn't the case with fstab.
 Perhaps if I were instead to include mount_smbfs commands in a script to
be run at boot time:
 #!/bin/sh
 mount_smbfs //[EMAIL PROTECTED]/Win\ Partition /mountpoint

 Is this the proper syntax for a script?  And if so, where would I put such
a file?
 Thank you,
 ~John

Since this is a script, I'd use judicious use of quotes to protect the shell
from messing things up.

#!/bin/sh
mount_smbfs //[EMAIL PROTECTED]/Win Partition /mountpoint

You can put a script like this in /usr/local/etc/rc.d, and it will get
executed automatically upon boot.

--
Matt Emmerton

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


spaces in fstab

2003-02-18 Thread Matt Smith
Could anyone tell me how to put spaces in fstab for mount points or
device names?

I am trying to use mount_smbfs to mount an SMB share with spaces in the
name.  However, I am sure this same difficulty would apply if my mount
point contained spaces, such as /home/me/My\ Documents.  I have tried
various combinations of \040, escaping, and quoting, with no luck so
far.  

Any thoughts?
-Matt

-- 
Matt Smith [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: spaces in fstab

2003-02-18 Thread Giorgos Keramidas
On 2003-02-18 12:08, Matt Smith [EMAIL PROTECTED] wrote:
 Could anyone tell me how to put spaces in fstab for mount points or
 device names?

 I am trying to use mount_smbfs to mount an SMB share with spaces in
 the name.  However, I am sure this same difficulty would apply if my
 mount point contained spaces, such as /home/me/My\ Documents.  I
 have tried various combinations of \040, escaping, and quoting, with
 no luck so far.

This is impossible with the current implementation of getfsent(3).
You can circumvent this by mounting at a pathname that doesn't include
space or tabs characters and symlink to it, i.e. with this in your
fstab:

/dev/ad0s3e  /home/me/my.docs  msdos  rw,noauto  2  2

You can always run:

# mount /home/me/my.docs

and then symlink /home/me/My Documents to /home/me/my.docs.

Giorgos.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-09 Thread Rob
  Sorry for this OT but I am trying for some hours to achieve a massive
  rename of files using a simple script and I have not success yet. I want
  to rename files like
 
  RESULTS OF JAN 01 2002.txt 
 
  to
 
  RESULTS_OF_JAN_01_2002.txt
 
  i.e. all the spaces, being substituted by '_', and the last space being
  completely removed [yes it has a space after the suffix]
  I tried to experiment with sed/awk and creating a sample sh script with
  for i in 'ls' 
 
  but the i takes values of 'RESULTS' 'OF' 'JAN'. This means that it doesnt
  take the full filename as value, but parts of the filenames.
 
 
  Can u please suggest an easy way to implement the massive rename?
 

 If you want to do it for all files in a directory:

 # for file in *; do mv $file `echo $file | sed -e 's/ /_/g'`; done

 should do the trick. I think Perl is overkill for something this simple.
 Someone else suggested tr, which probably works, but I've had more
 success with sed.

But if you do this, won't the spaces be mistaken for filename separators?

Try this instead - make sure you're using sh, not csh:

  ls *\ * | while read OLD ; do
NEW=`echo $OLD | tr ' ' _`
echo mv -i $OLD $NEW
done

This works because ls prints them on separate lines. Once you're sure that it
will do the right thing, take out the echo and run it for real.

If the files are all over the place, you can use find the same way:

  find * -name '* *' -type f | while read OLD ; do
NEW=`echo $OLD | tr ' ' _`
echo mv -i $OLD $NEW
done

You'll have to fix the directories separately (otherwise find gets lost).


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-09 Thread BigBrother (BigB3)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



On Fri, 10 Jan 2003, Rob wrote:

   Sorry for this OT but I am trying for some hours to achieve a massive
   rename of files using a simple script and I have not success yet. I want
   to rename files like
  
   RESULTS OF JAN 01 2002.txt 
  
   to
  
   RESULTS_OF_JAN_01_2002.txt
  
   i.e. all the spaces, being substituted by '_', and the last space being
   completely removed [yes it has a space after the suffix]
   I tried to experiment with sed/awk and creating a sample sh script with
   for i in 'ls' 
  
   but the i takes values of 'RESULTS' 'OF' 'JAN'. This means that it doesnt
   take the full filename as value, but parts of the filenames.
  
  
   Can u please suggest an easy way to implement the massive rename?
  
 
  If you want to do it for all files in a directory:
 
  # for file in *; do mv $file `echo $file | sed -e 's/ /_/g'`; done
 
  should do the trick. I think Perl is overkill for something this simple.
  Someone else suggested tr, which probably works, but I've had more
  success with sed.

 But if you do this, won't the spaces be mistaken for filename separators?

 Try this instead - make sure you're using sh, not csh:

   ls *\ * | while read OLD ; do
 NEW=`echo $OLD | tr ' ' _`
 echo mv -i $OLD $NEW
 done

 This works because ls prints them on separate lines. Once you're sure that it
 will do the right thing, take out the echo and run it for real.

 If the files are all over the place, you can use find the same way:

   find * -name '* *' -type f | while read OLD ; do
 NEW=`echo $OLD | tr ' ' _`
 echo mv -i $OLD $NEW
 done

 You'll have to fix the directories separately (otherwise find gets lost).





Thank you all for your quick reply.
I followed Rob's way and it was fairly easy to do. I had to change a bit
something but it worked.

The rename script that I used is:

- --cut here--
#!/bin/sh
ls *\ * | while read OLD ; do
NEW=`echo $OLD | tr ' ' _`
mv -i  $OLD $NEW
done
- -cut here--

As u notice I had to add the semicolon   in the $OLD variable because
otherwise the mv was complaining. So this was a nice and fast way to do
it. Thank you all people for your quick reply!!


BigBrother


- ---
We are being monitored..but there is a solution...
Use PGP for signing and encrypting emails
Download my public key at http://www.us.pgp.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+HZgpGe/V3CxAyHoRAnYRAJ9qGvtXc7cA7bdGJAbmRGNbyrHW9ACeLN95
1+0+V1Q76jtCW1jbVMdZZQA=
=8IWO
-END PGP SIGNATURE-

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-09 Thread Stijn Hoop
On Fri, Jan 10, 2003 at 01:49:18AM +1030, Rob wrote:
  If you want to do it for all files in a directory:
 
  # for file in *; do mv $file `echo $file | sed -e 's/ /_/g'`; done
 
  should do the trick. I think Perl is overkill for something this simple.
  Someone else suggested tr, which probably works, but I've had more
  success with sed.
 
 But if you do this, won't the spaces be mistaken for filename separators?

No, he has quotes around his $file, and the `` part replaces spaces,
so this should work. Witness:

$ touch a b c
$ for i in *; do echo arg $i endarg; done
arg a b endarg
arg c endarg

Another solution is using a find  awk combo, which makes it work
recursively (ie one commandline instead of one per directory):

$ find -d . -name '* *' | awk -F/ '{ OFS = /; o = $0; gsub( , _, $NF); print mv 
\ o \ \ $0 \ }' | sh

This can probably be written in a shorter way by awk gurus, I'm just
trying to learn it and this was a good exercise, which is the reason
I'm replying to this post :)

HTH,

--Stijn

-- 
The rain it raineth on the just
And also on the unjust fella,
But chiefly on the just, because
The unjust steals the just's umbrella.



msg14837/pgp0.pgp
Description: PGP signature


Re: Renaming files with spaces in the name to files without spaces..

2003-01-09 Thread Unix Tools
Conider the file freebsd help.doc

mv freebsd\ help.doc freebsdhelp.doc



- Original Message -
From: Gary W. Swearingen [EMAIL PROTECTED]
To: BigBrother (BigB3) [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, January 08, 2003 10:05 PM
Subject: Re: Renaming files with spaces in the name to files without
spaces..


 Paste this into your shell:

 XXX=RESULTS OF JAN 01 2002.txt 
 YYY=${XXX%% }
 ZZZ=$(echo ${YYY} | tr ' ' '_')

 for III in $XXX $YYY $ZZZ; do
 echo '$III'
 done


 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-09 Thread parv
in message [EMAIL PROTECTED],
wrote Stijn Hoop thusly...

 On Fri, Jan 10, 2003 at 01:49:18AM +1030, Rob wrote:
   If you want to do it for all files in a directory:
  
   # for file in *; do mv $file `echo $file | sed -e 's/ /_/g'`; done
  ^ ^
  ^ ^
  
  But if you do this, won't the spaces be mistaken for filename
  separators?
 
 No, he has quotes around his $file, and the `` part replaces
 spaces, so this should work.

notice that $file is not enclosed in the sub shell (in between 
``) as an argument to echo.  if the $file happens to have end
blanks, they will be eaten up.  try...

  f=' p q r '; echo $( echo $f | sed 's/ /_/g' )


...output /should/ have been '_p_q_r_', but is 'p_q_r'.


 $ touch a b c
 $ for i in *; do echo arg $i endarg; done
^ ^
^ ^
 arg a b endarg
 arg c endarg

notice that you have enclosed the string to echo in double quotes,
which preserves the spaces.


  - parv

-- 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files withoutspaces..

2003-01-09 Thread Duncan Anker
On Fri, 2003-01-10 at 06:10, Stijn Hoop wrote:
 On Thu, Jan 09, 2003 at 01:51:08PM -0500, parv wrote:
  in message [EMAIL PROTECTED],
  wrote Stijn Hoop thusly...
  
   On Fri, Jan 10, 2003 at 01:49:18AM +1030, Rob wrote:
 If you want to do it for all files in a directory:

 # for file in *; do mv $file `echo $file | sed -e 's/ /_/g'`; done
^ ^
^ ^

But if you do this, won't the spaces be mistaken for filename
separators?
   
   No, he has quotes around his $file, and the `` part replaces
   spaces, so this should work.
  
  notice that $file is not enclosed in the sub shell (in between 
  ``) as an argument to echo.  if the $file happens to have end
  blanks, they will be eaten up.  try...
  
f=' p q r '; echo $( echo $f | sed 's/ /_/g' )
  
  ...output /should/ have been '_p_q_r_', but is 'p_q_r'.
 
 Hey, great, missed that one. I only considered the 'space not at end'
 case. Thanks.

My bad, forgot to include the quotes. But OTOH, people who put spaces at
the beginning and end of their filenames deserve everything they get
(besides, it worked for the original poster's test case :-)



The information contained in this email is confidential.
If you are not the intended recipient, you may not disclose or use the
information in this email in any way.
Dark Blue Sea does not guarantee the integrity of any emails or attached
files.
The views or opinions expressed are the author's own and may not reflect
the views or opinions of Dark Blue Sea.
Dark Blue Sea does not warrant that any attachments are free from
viruses or other defects.
You assume all liability for any loss, damage or other consequences
which may arise from opening or using the attachments.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: entering smbfs shares with spaces in name in fstab

2003-01-08 Thread Matt Smith
On Wed, 2003-01-08 at 11:15, Thomas Spreng wrote:
  
 On Wed, Jan 08, 2003 at 09:43:22AM -0500, Matt Smith wrote:
  I am looking to make an entry in my fstab for an smb file share that has
  a space in  the name.
  
  snip one line from fstab
  
  //Account@NBName/MY SHARE  /mntpointsmbfs
  rw,noauto,-W=AccountDomain,-I=RealName.My.Domain.Edu 0 0
  
  /end snip
  
  I have tried many variations on the share name using double-quotes,
  single-quotes, \ , with no success.
  
  mount /mntpoint
  fstab: /etc/fstab:17: Inappropriate file type or format
  fstab: /etc/fstab:17: Inappropriate file type or format
  mount: /mntpoint: unknown special file or file system
  
  mount is parsing the fstab and using the space in the share name as a
  delimiter.
  
  Any ideas how I can make this entry in my fstab?  Unfortunately,
  renaming my share is NOT an option.
  
  Thanks all,
  -Matt
  
  
  -- 
  Matt Smith [EMAIL PROTECTED]
  
  
  To Unsubscribe: send mail to [EMAIL PROTECTED]
  with unsubscribe freebsd-questions in the body of the message
  
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message
Hi,
 
 you might try writing your space character as an ascii escape sequence (\040).
 
 bye,
   Tom
 
 
 
Tom -- thanks for the reply.  I found the same info on google, but it was from Linux 
sites.  Ufn, no luck -- now I get:
smbfs: unable to open connection: syserr = No such file or directory

To use the ascii escape sequence, do I need anything more than:
Account@NBName/MY\040SHARE  /mntpointsmbfs 
rw,noauto,-W=AccountDomain,-I=RealName.My.Domain.Edu 0 0


Even the following fails from a command line:
#mount -tsmbfs -o -I=RealName.My.Domain.Edu,-W=AccountDomain 
//Account@NBName/MY\040SHARE mntpoint/

This show a little more info (note the -d -v):
#mount -tsmbfs -d -v -o -I=RealName.My.Domain.Edu,-W=AccountDomain
//Account@NBName/MY\040SHARE mntpoint/

Which returns:
exec: mount -tsmbfs -d -v -o -I=RealName.My.Domain.Edu,-W=AccountDomain
//Account@NBName/MY040SHARE mntpoint/

Which seems to mean that \040 resolves to simply 040.


The following works (using \ ) from a command line:
#mount -tsmbfs -o -I=RealName.My.Domain.Edu,-W=AccountDomain
//Account@NBName/MY\ SHARE mntpoint/

But \  does NOT work in the fstab file.

Any other ideas, anyone?
-Matt

-- 
Matt Smith [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-08 Thread parv
in message [EMAIL PROTECTED], wrote
BigBrother (BigB3) thusly...

 Sorry for this OT but I am trying for some hours to achieve
 a massive rename of files using a simple script and I have not
 success yet. I want to rename files like
 
 RESULTS OF JAN 01 2002.txt 
 
 to
 
 RESULTS_OF_JAN_01_2002.txt

here is another way in perl (though it changes blanks to '-'; edit
as you desire)...

  http://www103.pair.com/parv/comp/src/perl/sanename.perl

  description...

http://www103.pair.com/parv/comp/src/perl/sanename.perl.pod


  - parv

-- 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Renaming files with spaces in the name to files without spaces..

2003-01-08 Thread Chris Doherty
On Wed, Jan 08, 2003 at 06:01:50PM +0200, BigBrother (BigB3) said: 
 -BEGIN PGP SIGNED MESSAGE-
 Sorry for this OT but I am trying for some hours to achieve a massive
 rename of files using a simple script and I have not success yet. I want
 to rename files like

there is already a general utility for this:
/usr/src/contrib/perl5/eg/rename .

leviathan:/home/chris:1168 /usr/src/contrib/perl5/eg/rename
Usage: rename perlexpr [filenames]

not only already written and tested, but you get to use perl regexen. :-)

HTH,
Chris

---
Chris Doherty
chris [at] randomcamel.net

I think, said Christopher Robin, that we ought to eat
all our provisions now, so we won't have so much to carry.
   -- A. A. Milne
---

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message