Re: [Freedos-user] if not exist? / Garbo's TSBAT

2013-02-15 Thread David C. Kerber


 -Original Message-
 From: Rugxulo [mailto:rugx...@gmail.com] 
 Sent: Friday, February 15, 2013 12:24 AM
 To: Discussion and general questions about FreeDOS.
 Subject: Re: [Freedos-user] if not exist? / Garbo's TSBAT
 
 Hi,
 
 On Thu, Feb 14, 2013 at 6:40 PM, dmccunney 
 dennis.mccun...@gmail.com wrote:
  On Thu, Feb 14, 2013 at 7:15 PM, Ray Davison 
 ray...@charter.net wrote:
 
  Is there something like this in FD?
 
  IF NOT EXIST X:\ZZZ MD X:\ZZZ
 
  Everything in front of the MD is ignored, and there is an error if
  X:\ZZZ does exist.
 
  IF NOT EXIST X:\ZZZ\NUL MD X:\ZZZ should do what you want.
 
 For completeness (though someone correct me if I'm remembering
 incorrectly), this hack is a typical DOS idiom, but ...
 
 1). It doesn't work under WinXP's CMD.EXE (etc.)
 2). DR-DOS' shell prefers direxist
 3). 4DOS supports both direxist and isdir

I don't know about DR-DOS or 4DOS, but this DOES work in Windows XP and Windows 
7.  It's just not necessary, because IF EXISTS works for directories with or 
without the \NUL on the end.

D

--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] if not exist?

2013-02-15 Thread Alain Mouette
Yes, that trick works since very old MS-DOS versions
;-)

Alain

Em 14-02-2013 22:30, Eric Auer escreveu:

 Hi!

 If that doesn't work then a exist.c should be made that friend 1 errorlevel
 if so let me know and I make it

 You misunderstood, IF EXIST does exists but has to
 be used in a special way for directory checks ;-)

 Is there something like this in FD?

 Yes of course: Type if /? to see how it should work.

 IF NOT EXIST X:\ZZZ MD X:\ZZZ

 Everything in front of the MD is ignored, and there is an error if
 X:\ZZZ does exist.

 I made some experiments: IF EXIST and IF NOT EXIST do
 what they should do for files, but apparently cannot
 check existence of directories. The trick, which also
 should work with MS DOS, is to use a CHARACTER DEVICE
 because those exist in all directories by definition:

 IF NOT EXIST X:\ZZZ\NUL MKDIR X:\ZZZ

 That does what you wanted to do :-)

 Eric

--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] if not exist? / Garbo's TSBAT

2013-02-15 Thread dmccunney
On Fri, Feb 15, 2013 at 12:23 AM, Rugxulo rugx...@gmail.com wrote:

 IF NOT EXIST X:\ZZZ\NUL MD X:\ZZZ should do what you want.

 For completeness (though someone correct me if I'm remembering
 incorrectly), this hack is a typical DOS idiom, but ...

 1). It doesn't work under WinXP's CMD.EXE (etc.)

It's not *needed* under 2K/XP CMD.EXE. Its IF EXIST tests for directories, too.

 2). DR-DOS' shell prefers direxist
 3). 4DOS supports both direxist and isdir

Correct.

I suppose it's *possible* to create a portable batch file that tries
to figure out what environment it's running in and does the right
thing for that environment.  I wouldn't even try.  If I need to use IF
EXIST X:\ZZZ\NUL to know if X:\ZZZ exists or must be created, it's a
special case, and I'll do the right thing for that environment.

 Timo Salmi had some good .BAT (and .CMD) FAQs back in the day. I
 should really email him to ask him for permission to mirror them (not
 sure if they are technically free/libre or not), esp. since Garbo went
 kaput. EDIT: Err, maybe not.   :-(

 http://lipas.uwasa.fi/~ts/garbo.html
 http://www.netikka.net/tsneti/info/tscmd.php

 
 An important note to Garbo repository users: The workstation hosting
 the Garbo repository at the University of Vaasa, Finland has broken
 down during 2012. The university's Computer Centre has informed me
 that it will not be replaced. Thus all the potentially remaining
 direct references to the utilities at Garbo in this FAQ are out of
 date.

It had been hosted on his personal workstation.  He retired, and it
died.  The University had funding issues, and chose not to spend the
money to replace and continue to support the machine.

 However, tscmd.zip continues to be available, now at a private ISP
 address. You may freely download it for your own, private purposes.
 But contrary to some past Garbo exceptional arrangements, I do not
 give permissions to mirroring, that is carrying my materials for
 downloading at other locations. (I am retired, fully served, since
 September 2011. I now say routinely no to all requests.)
 

 Well, no huge loss, as long as he still mirrors it online.

He is also still active in comp.os.msdos and elsewhere, and IIRC, his
FAQs are posted there.

Pity, though: Garbo mirrored a lot of old stuff besides Timo's
contributions.  They can be found elsewhere, but Timo's collection was
the first place a lot of folks looked.
__
Dennis
https://plus.google.com/u/0/105128793974319004519

--
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user