× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Inline--
Vern

At 11:50 AM 12/15/2003 -0600, you wrote:
> This is in the category of deleting files with invalid characters in the
> name.

I'm not sure what you mean by "invalid." If the character were truly
invalid, you wouldn't have been able to create the file in the first
place.

I consider a wildcard character to be invalid in an actual filename. Or at least dangerous. Am I mistaken?


> Also, I opened that file, in Windows, with TextPad. What I got was the
> other 5 files in the root. This is when I got worried.
>
> The problem is, if I try to delete this file in Windows Explorer, I would
> also be trying to delete QSYS.LIB - note the period in the middle of the
> name - and QFileSvr.400 - not my idea of a good time. And any files in root
> that had a period in the name - 5 in this case.

That's bizarre.  Windows Explorer does not, as far as I know, use
wildcards.  This implies that NetServer interprets wildcards when Windows
does not intend it to.

I've tried to duplicate this behavior by creating a file called *.* on my
FreeBSD box.  I accessed it from Network Neighborhood from a Win98
machine, but the filename appears as "~0%" (without the quotes) from
Windows. Deleting it doesn't seem to cause a problem.   Apparently the
SAMBA team anticipated this problem and converted the name to something
Windows would deal with correctly.

That implies to me that this is a bug in NetServer.

I agree - certainly a bug somewhere - but I'm not about to try to recreate it!


> QShell is even better, since the "rm" command definitely will not remove
> directories.

Sure it will.  You just have to specify the -d or -r switch to rm...
rmdir is equivalent to rm -d.   rm -r is like an MS-DOS "deltree" command,
it deletes not only the directories, but everything inside them.  (Not
that you wanted to do that, mind you...)

OK, I had not looked at the options - without options I was OK


MS-DOS has a similar level of safety.  In DOS and Win9x, DEL will not
delete directories, only their contents, you have to run DELTREE.  In
Win2k/XP DEL can delete directories, but it always asks you for
confirmation first.

Windows (using the GUI shell) doesn't use wildcards, it just sends the
filename as-is. Theoretically, you can't specify *.*, since it's not a
legal Windows filename.  Again, same level of safety.

That being an illegal name in Windows, I'd think it should not be allowed on the 400. I believe it came about by (incorrectly) specifying *.* as the destination in a "cp" command, esp. when I was copying with wildcards in the first place


cp *.file /*.*

or some such.

What DOES make OS/400 safer, however, is the security.  Most likely you
would not have been able to delete QSYS.LIB (not that I'm going to try it
to find out, mind you)

> So I first moved the stream files I wanted to keep into a new directory,
> leaving only *.* in the root. Then I started QShell and ran
>
> rm ???
>
> to remove only files with 3-character names, and this worked.

You took precautions, which is good.  But, "rm ???" would delete all of
the 3 character filenames in the directory, which doesn't seem like what
you wanted to do.

I'd moved everything to another directory before doing the remove


A safer way is not to use wildcards. You can prevent the shell from
interpreting wildcards by putting your argument in single quotes:

rm '*.*'

You can also escape the wildcards using the backslash:

rm \*\.\*

either of these methods would interpret the asterisk as a normal character
rather than as a wildcard, and therefore would only delete a file named
*.*, rather than deleting everything that matches the wildcard.

An even safer method would be to use the unlink() API, which will only
delete the exact characters you specify, it doesn't ever use wildcards,
and you can use it to delete characters which can't be typed at the
keyboard.

Not that any of this helps you right now, but it's nice to know.

Yeah, much appreciated - and I got out of this, fortunately.


Thanks
Vern



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.