Re: Windows shares using samba: problems with blank spaces.

From: JM (No_at_Spam.com)
Date: 09/18/04


Date: Sat, 18 Sep 2004 07:06:13 GMT

Mike Barba wrote:

> Our network has a window machine that needs to have disk space cleaned
> up. We are trying to delete files in specific folders that are more
> than 3 months old. We are trying to run a script on a linux box that
> will find all files older than three months old on the win box
> (through a samba share). However, samba returns error messages on the
> windows files/folders that have blank spaces in the name (ex: My
> Documents).
>
> Does anyone have a good solution to this problem?
>
> Your help is much appreciated.
>
> -Mike Barba

The best way I have found to deal with file names that have spaces is to set
the variable IFS. Something like this:

#!/bin/bash

IFS=$'\t\n'

for i in $( ls /samba )
do
 echo $i #this will echo the file names with spaces.
done

IFS=null