"[" and "]" characters in file names?
On my backup drives I organize my files like so...
Directories that hold categories have the names enclosed in square bracket.
i.e. "[Games]", "[Photos]".
Directories that hold Suites or collections from a specific vendor are named
in curly braces. i.e. "{Adobe}", "{Apple}"
These directories were created on a USB drive, formatted with NTFS.
I can access the drive without any issues, but the folders containing the
[ ] characters are not visible.
Linux allows me to create files with the square brackets, so I don't know
why these directories would not be visible or accessible.
Any ideas how I can have these directories become visible?
Re: "[" and "]" characters in file names?
On Fri, 20 Jul 2007, in the Usenet newsgroup alt.os.linux.suse, in article
<hE4oi.131845$xq1.19010@pd7urf1no>, Noozer wrote:
[color=blue]
>On my backup drives I organize my files like so...
>
>Directories that hold categories have the names enclosed in square
>bracket .i.e. "[Games]", "[Photos]".
>
>Directories that hold Suites or collections from a specific vendor are
>named in curly braces. i.e. "{Adobe}", "{Apple}"[/color]
And I'm sure the names look nice - but you're creating extra work for
yourself, and crating some interesting opportunities for disasters.
[color=blue]
>These directories were created on a USB drive, formatted with NTFS.
>
>I can access the drive without any issues, but the folders containing the
>[ ] characters are not visible.[/color]
Yes. 'man bash' and look for "Compound Commands", "Parameters"... there
are so many ways to shoot yourself in the foot.
[color=blue]
>Linux allows me to create files with the square brackets, so I don't
>know why these directories would not be visible or accessible.[/color]
The only characters not "legal" in a file name are the slash which is
used as a directory separator, and the null byte (0x0) which is used to
mark the end of a string. I don't use windoze, so microsoft may have
also added other forbidden characters to their file system - you'll
have to research that on your own. HOWEVER - you then have to play with
the shell rules relating to wild-cards. Look in that man page for the
section "Pathname Expansion". Your pretty name "[Games]" is being
expanded by the shell into five names "G", "a", "m", "e" _or_ "s" - the
letters you have told the shell are suitable equivalents when you
enclosed those five letters in square brackets. As you don't have a
directory named "G", "a", "m", "e" or "s" in the same place you
stashed the "[Games]" directory, the shell can't find anything in them.
Just because you _can_ do something doesn't mean it's a great idea.
[color=blue]
>Any ideas how I can have these directories become visible?[/color]
Get rid of those square brackets, OR escape them then you try to refer
to them (\[Games\]). The curly braces aren't the best idea either.
Old guy
Re: "[" and "]" characters in file names?
Moe Trin wrote:[color=blue]
> Get rid of those square brackets, OR escape them then you try to refer
> to them (\[Games\]). The curly braces aren't the best idea either.[/color]
If they aren't best idea, then why add them? Now you need to do
'\(\[Games\]\)\'. Wait "\'\(\[....
;-)
I remember having problems with files starting with a dash, like -File.
To move them you need to do `rm -- -File`
houghi
--
Let's not be too tough on our own ignorance. It's the thing that makes
America great. If America weren't incomparably ignorant, how could we
have tolerated the last eight years? -- Frank Zappa, in 1988
Re: "[" and "]" characters in file names?
On Sat, 21 Jul 2007, in the Usenet newsgroup alt.os.linux.suse, in article
<slrnfa4tvp.4j0.houghi@penne.houghi>, houghi wrote:
[color=blue]
>I remember having problems with files starting with a dash, like -File.
>To move them you need to do `rm -- -File`[/color]
They might 'move' better if you used the 'mv' command, but hey, an 'rm'
command does move the file to another area of your mind
Actually, that's been a part of various FAQs since before Linus started
playing with a 386 in 1991. Lessee, I guess Ted Timar isn't posting the
UNIX FAQ to comp.unix.questions, comp.unix.shell, comp.answers, and
news.answers any more, but the second part (of seven) began
Archive-name: unix-faq/faq/part2
Version: $Id: part2,v 2.9 1996/06/11 13:07:56 tmatimar Exp $
This article includes answers to:
2.1) How do I remove a file whose name begins with a "-" ?
2.2) How do I remove a file with funny characters in the filename ?
Any search engine should find it - if it's not at rtfm.mit.edu in the
directory pub/usenet/news.answers.
There actually are many possible solutions - everything from using the
double dash in GNU commands, to using more of the filename (relative or
absolute filenames work great), using wild-cards (very carefully) and so
on. The problem existed several decades ago, and so have the solutions.
Sometimes you may need to actually think - like when you get filenames
that contain 'control characters' such as a Control-U (^U) which can be
good for a lot of laughter - but it's not like this is a new concept.
Old guy
Re: "[" and "]" characters in file names?
"Noozer" <dont.spam@me.here> wrote in message
news:hE4oi.131845$xq1.19010@pd7urf1no...[color=blue]
> I can access the drive without any issues, but the folders containing the
> [ ] characters are not visible.[/color]
It turned out to be a corrupt filesystem and it was just a coincidence that
if affected those particular directories.
Files moved, drive formatted, files moved back and all is well.
Re: "[" and "]" characters in file names?
Moe Trin wrote:[color=blue]
> On Sat, 21 Jul 2007, in the Usenet newsgroup alt.os.linux.suse, in article
> <slrnfa4tvp.4j0.houghi@penne.houghi>, houghi wrote:
>[color=green]
>>I remember having problems with files starting with a dash, like -File.
>>To move them you need to do `rm -- -File`[/color]
>
> They might 'move' better if you used the 'mv' command, but hey, an 'rm'
> command does move the file to another area of your mind[/color]
:-) Oops.
[color=blue]
> Actually, that's been a part of various FAQs since before Linus started
> playing with a 386 in 1991. Lessee, I guess Ted Timar isn't posting the
> UNIX FAQ to comp.unix.questions, comp.unix.shell, comp.answers, and
> news.answers any more, but the second part (of seven) began[/color]
Yes, yet as a beginner it can be frustrating when you do not know it. It
is great when you have the solution, because that makes it easier to
find it.
houghi
--
First we thought the PC was a calculator. Then we found out how to turn
numbers into letters with ASCII and we thought it was a typewriter. Then
we discovered graphics, and we thought it was television. With the World
Wide Web, we've realized it's a brochure. -- Douglas Adams.