Deleting directories in SMS.....

A place to discuss general QL issues.
prime
Trump Card
Posts: 192
Joined: Fri Feb 18, 2011 8:58 pm

Deleting directories in SMS.....

Post by prime »

Hi all,

I'm playing round with QPC2, and managed to fill up the boot win file with part of the SMSQ/E source which I'd like to delete, is there an easy way of deleting a directory and sub-directories sorta like deltree in dos / windows or rm -r in Linux / Unix ?

I tried wdel foldername_ and it asked me if I wanted to do it but seemed to do nothing, and returned no error :(

Cheers.

Phill.


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Deleting directories in SMS.....

Post by dilwyn »

prime wrote:Hi all,

I'm playing round with QPC2, and managed to fill up the boot win file with part of the SMSQ/E source which I'd like to delete, is there an easy way of deleting a directory and sub-directories sorta like deltree in dos / windows or rm -r in Linux / Unix ?

I tried wdel foldername_ and it asked me if I wanted to do it but seemed to do nothing, and returned no error :(

Cheers.

Phill.
This is a problem I used to get. A directory cannot be deleted unless it's empty, so you have to go through directories individually emptying them, then they'll delete in the usual way with DELETE or whatever.

If you have the Phil Borman WD_ extensions (they were supplied with the Qubide utilities disk, or you can get them from the Toolkits page on my website http://www.dilwyn.me.uk/tk/wd.zip ) you can use WDDEL from the WD_BIN extensions file to wildcard delete every file in the named directory and sub-directories, but be careful, it's all too easy to wipe an entire drive with this by accident! e.g. WDDEL WIN1_ will offer to delete the WHOLE of WIn1_, while WDDEL WIN1_QUILL_ would delete all files in WIn1_Quill_ plus all files in all sub-directories.

Another way in theory (not actually tried this) is to use the QPAC2 files menu to display the TREE of files F3, Tree) for the directory in question, then Delete to delete those highlighted files. Once the files have been deleted, you should then be able to do the same for directories. NOTE: I've never actually tried this for real!


User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Deleting directories in SMS.....

Post by tofro »

C68 has a port of Unix/Linux rm included. This, used with its "-rf" option, does the trick.

Although I had like Dilwyn assumed the "show full tree" option in QPAC2 should to the same trick, it doesn't ;) - Cleans the files but leaves directories intact (Which makes that option a bit questionable, because that would have been the only occasion where I had imagined it would be of any use...)

Regards,
Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
prime
Trump Card
Posts: 192
Joined: Fri Feb 18, 2011 8:58 pm

Re: Deleting directories in SMS.....

Post by prime »

Thanks guys, I extracted rm from c68 and used that, did the trick without problems.

Cheers.

Phill.


User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Deleting directories in SMS.....

Post by dilwyn »

prime wrote:Thanks guys, I extracted rm from c68 and used that, did the trick without problems.

Cheers.

Phill.
I realised my little copier routine I wrote a while back could easily be adapted for the job of bulk deleting all files and all directories. The listing is below - SuperBASIC, but needs Toolkit 2.

It asks you to enter the drive name and then the directory name to start deleting. If you leave the directory blank, it deletes EVERYTHING it can on that drive.

So: statutory warning: Be careful with this routine. All too easy to delete everything from your hard disk!

Code: Select all

100 REMark delete all files and all sub-directories from drive/directory
110 CLS : CLS #0
120 INPUT #0,'Delete all files from which drive > ';dr$
130 IF dr$ = '' THEN STOP
140 INPUT #0,'and which directory (blank entry for entire drive) > ';dd$
150 IF dd$ <> '' THEN
160   IF dd$(LEN(dd$))<>'_' THEN dd$ = dd$&'_'
170 END IF
180 INPUT #0,'DELETE ALL FILES FROM ';dr$&dd$;' - ARE YOU SURE Y/N > ';yn$
190 IF NOT(yn$=='y') THEN STOP
200 PRINT #0,'Deleting files...'
210 fdels = 0 : ddels = 0 : REMark count files and directories deleted
220 Extended_DIR dr$,dd$
230 PRINT \fdels;' files and ';ddels;' directories deleted.'
240 PRINT #0,'Program finished.'
250 STOP
260 :
270 DEFine PROCedure Extended_DIR (drive$,directory$)
280   LOCal loop,ch,d$,fp,n$,pass
290   FOR pass = 1 TO 2
300     REMark Pass 1=Delete all files
310     REMark Pass 2=Delete all directories
320     ch = FOP_DIR (drive$&directory$) : REMark open directory channel
330     IF ch < 0 THEN RETurn : REMark unable to open directory
340     fp = 14 : REMark file position in directory for filename
350     REPeat loop
360       BGET #ch\fp : IF EOF(#ch) THEN CLOSE #ch : EXIT loop
370       GET #ch,d$ : REMark get directory entry name
380       IF LEN(d$) > 0 THEN
390         REMark a directory length of 0 may be a deleted file
400         BGET #ch\fp-9 : REMark file type byte
410         IF CODE(INKEY$(#ch)) = 255 THEN
420           Extended_DIR drive$,d$
430           IF pass = 2 THEN
440             PRINT'Deleting directory ';drive$&d$;'...' : DELETE dr$&d$
450             ddels = ddels+1
460           END IF
470         ELSE
480           PRINT'Deleting file ';drive$&d$;'...' : DELETE dr$&d$
490           fdels = fdels+1
500         END IF
510       END IF
520       fp = fp + 64
530     END REPeat loop
540   END FOR pass
550 END DEFine Extended_DIR


User avatar
qxl-kumbah
ROM Dongle
Posts: 24
Joined: Thu Apr 17, 2014 11:56 pm
Location: Waltham, MA

Re: Deleting directories in SMS.....

Post by qxl-kumbah »

Hi there,

I've been lucking for awhile, and wonder something:

I don't see any way to create a directory, except using DOS (which doesn't
work (since it doesn't read QXL disks)) or one of the GUIs that I've seen.

I've been poring over the QDOS manual, and can't locate any way to do it
except by (maybe) unzipping a file and using the -d directive to "create
directories and paths".

(- then again, I'm going by the MS-DOS unzip program not the QDOS version)

It is my understanding that running a QXL under SMSQ cannot do it?

Does running it using SMSQ/E instead add that facility?

[ the disk I had (and installed) put SMSQ/E in there, but I really don't
have much documentation on the commands, yet. ]

Anyhow, I'm planning on eventually adding Launchpad (as a start) to
getting a GUI in place to ease the typing "load", but I am slowly learning
to get my SuperBASIC abilities back.

- qxl-kumbah -
"QLX, QLay, and Qemulator on board"


* qxl-kumbah *
"TS-1000, Eighty-One,TS-2068, Spectrum Anywhere, QXL, QLay, and Qemulator on board"
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Deleting directories in SMS.....

Post by tofro »

qxl-kumbah wrote: Does running it using SMSQ/E instead add that facility?
I don't really know whether the SMSQ (without the /E) would have it, but SMSQ/E for the QXL definitely has a make_dir command that will happily create directories in QXL.WIN files. But I must admit I've never really looked besides SMSQ/E since I got the card - I figured next to "original" QDOS, Minerva and SMSQ/E there wouldn't be room for another QDOS derivate in my lair. SMSQ/E definitely has some advantage here - I use the exact same QXL.win files on QXL and QPC2, and can easily exchange them between the two platforms. My QXL PC has been acting as a file server for the network of (2) QLs for quite some years now. And with the license situation today, there shouldn't be any reason not to use SMSQ/E on the QXL.

BTW: Nice to have another QXL user here in the forum - They're getting rare, much rarer than "original" QL stuff - I reckon a lot of them just ended up in the dump because they hide so well in "ordinary" PCs.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Deleting directories in SMS.....

Post by dilwyn »

qxl-kumbah wrote:Hi there,
I've been lucking for awhile, and wonder something:
I don't see any way to create a directory, except using DOS (which doesn't
work (since it doesn't read QXL disks)) or one of the GUIs that I've seen.
I've been poring over the QDOS manual, and can't locate any way to do it
except by (maybe) unzipping a file and using the -d directive to "create
directories and paths".
(- then again, I'm going by the MS-DOS unzip program not the QDOS version)
It is my understanding that running a QXL under SMSQ cannot do it?
Does running it using SMSQ/E instead add that facility?
[ the disk I had (and installed) put SMSQ/E in there, but I really don't
have much documentation on the commands, yet. ]
Anyhow, I'm planning on eventually adding Launchpad (as a start) to
getting a GUI in place to ease the typing "load", but I am slowly learning
to get my SuperBASIC abilities back.
- qxl-kumbah -
"QLX, QLay, and Qemulator on board"
I hope I understand the problem correctly.

MAKE_DIR win1_dirname_ should create a directory called DIRNAME_ on drive WIN1_

SMSQ/E documentation can be found on my eBooks page at http://www.dilwyn.me.uk/docs/ebooks/index.html

Launchpad - it is now a fairly old program but still works on modern systems. Most recent version is v2.10 which works with high colour and window manager 2 on modern SMSQ/E. There is an older v0.96 for use on older systems and emulators not supporting new colours and window manager 2, but that hasn't been updated for several years.


User avatar
qxl-kumbah
ROM Dongle
Posts: 24
Joined: Thu Apr 17, 2014 11:56 pm
Location: Waltham, MA

Re: Deleting directories in SMS.....

Post by qxl-kumbah »

Hiya dilwyn,

Ah, thanks for that - will have to try it. :)

Does that "make_dir" command work on just SMSQ ?

Despite the program being old, or not updates, it's precisely what
I'm looking for - at least for now ...

I'll have to download them both and see which one works the best.

Is the "one in green", the first version?


* qxl-kumbah *
"TS-1000, Eighty-One,TS-2068, Spectrum Anywhere, QXL, QLay, and Qemulator on board"
User avatar
dilwyn
Mr QL
Posts: 2753
Joined: Wed Dec 01, 2010 10:39 pm

Re: Deleting directories in SMS.....

Post by dilwyn »

qxl-kumbah wrote:Hiya dilwyn,
Ah, thanks for that - will have to try it. :)
Does that "make_dir" command work on just SMSQ ?
Despite the program being old, or not updates, it's precisely what
I'm looking for - at least for now ...
I'll have to download them both and see which one works the best.
Is the "one in green", the first version?
I think it does, at least in more recent versions of the old "vanilla" SMSQ. I used to have a QXL many years ago, plugged into an ISA slot in a pretty massive Amstrad ALT-286 portable PC with mono screen. In those days, they called those "luggables" not "laptops!" Still, it was a great way of making a 286 PC usable. To be honest, since you can download QXL SMSQ/E from Wolfgang Lenerz's site these days I wouldn't bother with SMSQ unless you want to run without pointer environment, or test software on the older O.S.

Launchpad - no, the screen dumps are both from version 2.10. From memory, I don't think there was a screen dump from v0.96 (I wanted to encourage people to use version 2), if there was it'd be plain mode 4 white, with red green and black text and icons. If you are going to be using SMSQ/E, and it's recent enough to run Launchpad 2, I'd not even consider v0.96 as version 2 has a lot of extra features.

Launchpad is still commercial software and can be bought on disk from Bruce Nicholls at Quo Vadis Design. If you'd rather just download and get a password, email or PM (private message) me and I'll tell you how.


Post Reply