Re: [ql-users] recursive delete

2002-04-30 Thread RWAPSoftware
In a message dated 29/04/02 23:30:35 GMT Daylight Time, [EMAIL PROTECTED] writes:


Don't forget we already have one trashcan, that programmed on Qubide 2
ROMs.
And that one had serious problems mainly due to the way that QDOS and 
SMSQ/E handled thing like MOVE. Beware if you are using it. Rich Mellor 
knows more about this than I do.


Roy is right - the trashcan built into the QuBide 2 ROMs does not appear at all safe. It appears the problem mainly occurs when a program overwrites an existing file - the trashcan sees the previous one as deleted and tries to store it in the trashcan, but instead seems to grab a pointer to the new file (there is no old one to copy to the trashcan, as overwrite was used instead of delete). As a result, you remove this one from the trashcan and hey presto! your original file either no longer exists or is corrupted!!

As a result, I gave in trying to use the trashcan feature a long time ago.

Rich Mellor 
RWAP Software
7 Common Road, Kinsley, Pontefract, West Yorkshire, WF9 5JR
TEL: 01977 614299
http://hometown.aol.co.uk/rwapsoftware


RE: [ql-users] recursive delete

2002-04-29 Thread Claude Mourier 00

Sad no one wrote such a utility or keyword : seems quite easy !

-Message d'origine-
De : Dilwyn Jones [mailto:[EMAIL PROTECTED]]
Envoyé : samedi 27 avril 2002 14:13
À : QL Users List
Objet : Re: [ql-users] recursive delete

One way around this if using QPAC2 is to create a directory called say
TRASH and instead of deleting files, use the MOVE command to shift
them into the TRASH directory instead. When you run short of space, or
from time to time (say, when files are a few days old and you are sure
you don't want any of them, delete them from the trashcan, after a
while you'll get used to the routine of using MOVE instead of DELETE
and using DELETE only on the trashcan. Hate to say it, but the Recycle
folder is one area of Windoze we could do with emulating in SMSQ/E and
QDOS.


--
Dilwyn Jones
[EMAIL PROTECTED]
http://www.soft.net.uk/dj/index.html




RE: [ql-users] recursive delete

2002-04-29 Thread Norman Dunbar

Don't get me started :o)

Norman.

-
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:[EMAIL PROTECTED]
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-


-Original Message-
From: Claude Mourier 00 [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 8:50 AM
To: '[EMAIL PROTECTED]'
Subject: RE: [ql-users] recursive delete


Sad no one wrote such a utility or keyword : seems quite easy !

-Message d'origine-
De : Dilwyn Jones [mailto:[EMAIL PROTECTED]]
Envoyé : samedi 27 avril 2002 14:13
À : QL Users List
Objet : Re: [ql-users] recursive delete

One way around this if using QPAC2 is to create a directory called say
TRASH and instead of deleting files, use the MOVE command to shift
them into the TRASH directory instead.SNIP
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged.  If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents.  If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.



Re: [ql-users] recursive delete

2002-04-29 Thread Dilwyn Jones

One way around this if using QPAC2 is to create a directory called
say
TRASH and instead of deleting files, use the MOVE command to shift
them into the TRASH directory instead. When you run short of space,
or

Sad no one wrote such a utility or keyword : seems quite easy !


There are some problems with this approach:

1. There is no UNDELETE info saved i.e. where to put it back to when
you undelete, you have to locate and restore manually!

2. Filename lengths. Delete WIN1_12345678901234567890123456789012_txt
(OK, silly example) would fail as you'd be attempting to move a 36
character filename to WIN1_TRASH_ or whatever - QL filename length
limit strikes again. You'd have to truncate long file names. One way
around it is to use a very short name for the directory, something you
won't normally use or delete accidentally, but which stands out in a
list, something like WIN1_@ for example.

3. Deleting whole directories does not create the directory in the
trashcan.

I'm sure we could think of others. Basically, a small set of BASIC
extensions could be written along the lines of:

SET_TRASH 'win1_@_'

TRASH 'filename' - move

UNTRASH 'filename' TO 'restored_filename'

PURGE_TRASH- deletes everything in the trashcan, possibly with
qualifiers such as PURGE_TRASH date_value to delete everything older
than a given date, or PURGE_TRASH '_bas' to remove all BASIC programs.

The action of TRASH would be to COPY and DELETE if the filename being
deleted and the trashcan were not on the same drive. If one the same
drive it could be RENAME except for microdrives which don't support
rename. I would, however, foresee that each medium has its own
'trashcan'

Anyone fancy taking on this challenge? As I've proposed it, it's
fairly basic of course, so you may prefer to build on this.

Don't forget we already have one trashcan, that programmed on Qubide 2
ROMs.

--
Dilwyn Jones
[EMAIL PROTECTED]
http://www.soft.net.uk/dj/index.html





Re: [ql-users] recursive delete

2002-04-29 Thread Roy Wood

In message 003201c1efa5$87a27da0$62065cc3@default, Dilwyn Jones 
[EMAIL PROTECTED] writes
SNIP
Anyone fancy taking on this challenge? As I've proposed it, it's
fairly basic of course, so you may prefer to build on this.

Don't forget we already have one trashcan, that programmed on Qubide 2
ROMs.
And that one had serious problems mainly due to the way that QDOS and 
SMSQ/E handled thing like MOVE. Beware if you are using it. Rich Mellor 
knows more about this than I do.
-- 
Roy Wood
Q Branch, 20 Locks Hill Portslade. Sussex. BN41 2LB. UK
Tel : +44 (0)1273 386030 Fax : +44 (0)1273 430501 (New number!)
Mobile +44(0)7836 745501
Web : www.qbranch.demon.co.uk





Re: [ql-users] recursive delete

2002-04-28 Thread Michael Grunditz

Il port gnu fileutils , and save my money..:)

/Michael

In message [EMAIL PROTECTED]
  Roy Wood [EMAIL PROTECTED] wrote:

 You could also buy a copy of Cueshell which will move, delete or copy 
 whole sub directories. You can, for instance, copy a sub directory and 
 it will re-create any sub directories within the original. Great program




Re: [ql-users] recursive delete

2002-04-28 Thread Joachim Van der Auwera

 You could also buy a copy of Cueshell which will move, delete or copy
 whole sub directories. You can, for instance, copy a sub directory and
 it will re-create any sub directories within the original. Great program

Again, command line tools for all thos are also included in ProWesS... And
it is free too.

Joachim




Re: [ql-users] recursive delete

2002-04-28 Thread Derek Stewart

Is this an advert ..

Derek

- Original Message - 
From: Roy Wood [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, April 28, 2002 12:21 AM
Subject: Re: [ql-users] recursive delete


 You could also buy a copy of Cueshell which will move, delete or copy 
 whole sub directories. You can, for instance, copy a sub directory and 
 it will re-create any sub directories within the original. Great program
 -- 
 Roy Wood
 Q Branch, 20 Locks Hill Portslade. Sussex. BN41 2LB. UK
 Tel : +44 (0)1273 386030 Fax : +44 (0)1273 430501 (New number!)
 Mobile +44(0)7836 745501
 Web : www.qbranch.demon.co.uk
 
 
 




Re: [ql-users] recursive delete

2002-04-28 Thread Claus Graf

Hi,

Phoebus, thanks for sending me sh plus several other goodies.
Peter, thanks for the offer, but Phoebus can't be beaten ;)

I now have tried the rm -r or rm -rf or rm -ri, that I also know from unix.
But it didn't work for me with real level 2 subfolders. 
Phoebus, did you really checked it out? Or am I doing something wrong?

Thanks,

Claus 



Re: [ql-users] recursive delete

2002-04-28 Thread Dilwyn Jones

Claus - I can email you a copy of The Shell if you wish.

It is not on my site - I am running out of room! It might be on
Thierry's QDOS Repository - try via Phoebus's website
www.dokos-gr.net/~phoebus/ until Thierry's site is fixed when he gets
back to France (Phoebus has a mirror or copy of the site there I
think).

If you have still not managed to find it, send me an email to let me
know and I'll email a zipped Shell to you.

--
Dilwyn Jones
[EMAIL PROTECTED]
http://www.soft.net.uk/dj/index.html

I feel quite silly, but I cannot find the shell neither at Thierry's
nor Dilwyn's site. Can anyone give me a hint?
thanks,
Claus





Re: [ql-users] recursive delete

2002-04-27 Thread Joachim Van der Auwera

 How do I do a recursive delete in qdos ?

There is also a tool as part of ProWesS which does this.
It is included to make the automatic installation work.

The syntax is:
ex delete;-tree directory
Where the delete program is fount in the pws_bin directory.

Joachim




Re: [ql-users] recursive delete

2002-04-27 Thread Dilwyn Jones

Claus Graf wrote:
plus deleting the directories (if any real on), this can be sucking
because qpac2 cannot delete directories that conatin subfolders, what
a pity that qpac2 isn't developed any further by TT,

If you have a single directory name with no subdirectories, it can be
hard to delete it using QPAC2, since if you DO on the file to try to
bring up the commands menu, QPAC2 tries to enter the directory
instead. The way around this is to HIT (left mouse click for those of
other operating system persuasions) the directory name then on an
unused part of the QPAC2 window, DO (right click) to bring up the
qpac2 commands menu and select the DELETE command, which will
successfully delete an empty single folder name.

--
Dilwyn Jones
[EMAIL PROTECTED]
http://www.soft.net.uk/dj/index.html




Re: [ql-users] recursive delete

2002-04-27 Thread Dilwyn Jones

Michael Grunditz writes:

 How do I do a recursive delete in qdos ?

With extreme care!! Requires TK2.

Per

If you have the WDxxx extensions by Phil Borman, which were supplied
with Qubide, you can simply enter the command:

WDDEL win1_

which will wipe files (but not directories) from your hard disk. As
Per says, extreme caution!


If you use QPAC2, you could set the TREE command to on for the drive
or directory you want and then use DELETE to remove the files. Again,
CAUTION - it's easy to make a mistake and regret it, there is no
undelete in QDOS/SMSQ unless you are using Qubide Trashcan.

One way around this if using QPAC2 is to create a directory called say
TRASH and instead of deleting files, use the MOVE command to shift
them into the TRASH directory instead. When you run short of space, or
from time to time (say, when files are a few days old and you are sure
you don't want any of them, delete them from the trashcan, after a
while you'll get used to the routine of using MOVE instead of DELETE
and using DELETE only on the trashcan. Hate to say it, but the Recycle
folder is one area of Windoze we could do with emulating in SMSQ/E and
QDOS.


--
Dilwyn Jones
[EMAIL PROTECTED]
http://www.soft.net.uk/dj/index.html





Re: [ql-users] recursive delete

2002-04-27 Thread Marcel Kilgus

Dilwyn Jones wrote: 
 If you use QPAC2, you could set the TREE command to on for the drive
 or directory you want and then use DELETE to remove the files. Again,
 CAUTION - it's easy to make a mistake and regret it, there is no
 undelete in QDOS/SMSQ unless you are using Qubide Trashcan.

I think the best and most simple way to handle recursive directories
is through CueShell.

Marcel




Re: [ql-users] recursive delete

2002-04-27 Thread Claus Graf

On Sat, 27 Apr 2002 08:05:10 +0100 (BST)
[EMAIL PROTECTED] wrote:

 Michael Grunditz [EMAIL PROTECTED] asked:
 
  Hi
 
  How do I do a recursive delete in qdos ?
 
 
  /Michael
 
 The easiest way is to load Adrian Ives shell and its associated utilities.  Then you 
just type
 
   rm -r
 
 at the prompt.  Although when I used to teach UNIX I always made my students use rm 
-ir for safety!!
 
 Peter

I feel quite silly, but I cannot find the shell neither at Thierry's nor Dilwyn's 
site. Can anyone give me a hint?
thanks,
Claus 



Re: [ql-users] recursive delete

2002-04-27 Thread Roy Wood

You could also buy a copy of Cueshell which will move, delete or copy 
whole sub directories. You can, for instance, copy a sub directory and 
it will re-create any sub directories within the original. Great program
-- 
Roy Wood
Q Branch, 20 Locks Hill Portslade. Sussex. BN41 2LB. UK
Tel : +44 (0)1273 386030 Fax : +44 (0)1273 430501 (New number!)
Mobile +44(0)7836 745501
Web : www.qbranch.demon.co.uk





RE: [ql-users] recursive delete

2002-04-26 Thread Norman Dunbar

Do you mean like :

win1_
win1_top_
win1_top_file_a
win1_top_file_b
win1_top_next_
win1_top_next_file_1
win1_top_next_file_2


So you want to delete win1_top_ and get everything under it deleted as well
?

If so, then unfortunately, you can't.
However, with a bit of coding, you can. You have to code up a routine that
opens the directory and reads from it.
For each entry where the name is not length zero
if the file type is 255 (miracle hard disc, QPC and QXL 'hard' disc) then
   recurse into this as a directory
end if
delete the file (if it was a directory, it should be empty by now !)

For an example of recursing down a directory tree form any given start
point, see the source code for WinBack as available on Dilwyn's web site.
This uses a procedure called check_dir - as shown below (it uses DJToolkit)
to open and read from directories. (FOPEN_DIRECTORY, FREAD_DIRECTORY and
END_OF_DIRECTORY). I'm sure you can extract the meat from the bones and get
something useful from it.

Cheers,
Norman.



4745 DEFine PROCedure check_dir(d$)
4750   LOCal name_len%, curr_d$(40), curr_f$(41), entry$(64), loop
4755   LOCal qdos, err_loop, err1_loop, key(1)
4760   :
4765   REMark ** Process each directory entry in turn, ignoring nulls,  **
4770   REMark ** if a sub-directory is found, process it if required, if**
4775   REMark ** a data or program file is found then dump it to floppy **
4780   REMark ** if it has been updated since the last archive was done **
4785   :
4790   level = level + 1
4795   curr_d$ = d$
4800   REPeat err_loop
4805  qdos = FOPEN_DIRECTORY(curr_d$)
4810  IF qdos  0
4815 abandon qdos, 'Cannot open directory '  curr_d$
4820  ELSE 
4825 EXIT err_loop
4830  END IF 
4835   END REPeat err_loop
4840   directories = directories + 1
4845   update_tv 1
4850   REPeat loop
4855 IF END_OF_DIRECTORY(#qdos) THEN EXIT loop: END IF 
4860 CURSOR_ON #main !
4865 key = INKEY$(#main, 5)
4870 CURSOR_OFF #main
4875 IF key = escape
4880aborted = 1: REMark ** Who pressed ESC then ? **
4885EXIT loop
4890 END IF 
4895 IF key = SHIFT_F4
4900show_title
4905tv
4910update_tv 1
4915update_tv 2
4920show_free_space
4925 END IF 
4930 entry$ = FREAD_DIRECTORY$(#qdos)
4935 IF entry$ = '' THEN NEXT loop: END IF 
4940 name_len% = word%(entry$(15 TO 16))
4945 IF NOT (name_len%) THEN NEXT loop: END IF 
4950 curr_f$ = curr_d$(1 TO 5)  entry$(17 TO (17 + name_len% - 1))
4955 IF CODE(entry$(6)) = 255
4960:
4965REMark ** Sub-directory **
4970:
4975IF do_subs
4980   :
4985   REMark ** Processing all sub-directories **
4990   :
4995   check_dir (curr_f$)
5000   IF aborted THEN EXIT loop : END IF 
5005   update_tv 1
5010ELSE 
5015   :
5020   REMark ** Not processing any sub-directories **
5025   :
5030   NEXT loop
5035END IF 
5040 ELSE 
5045:
5050REMark ** Data or program file **
5055:
5060REPeat err1_loop
5065  file_size = FILE_length(curr_f$)
5070  IF file_size  0
5075 abandon file_size, 'Cannot read header of '  curr_f$
5080 NEXT err1_loop
5085  END IF 
5090  EXIT err1_loop
5095END REPeat err1_loop
5100files = files + 1
5105t_file_size = t_file_size + file_size
5110updated = FILE_update(curr_f$)
5115archived = FILE_backup(curr_f$)
5120update_tv 2
5125IF (updated  archived) OR do_all
5130   :
5135   REMark ** File updated since last backup taken or  **
5140   REMark ** the user requested all files be archived **
5145   :
5150   IF list_only
5155  f_archived = f_archived + 1
5160  lprint curr_f$
5165   ELSE 
5170  archive_file (curr_f$), (file_size)
5175   END IF 
5180ELSE 
5185   :
5190   REMark ** File not changed since last backup taken **
5195   :
5200   f_narchived = f_narchived + 1
5205END IF 
5210 END IF 
5215 update_tv 1
5220 update_tv 2
5225   END REPeat loop
5230   CLOSE_DIRECTORY #qdos
5235   level = level - 1
5240 END DEFine check_dir


-
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:[EMAIL PROTECTED]
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-


-Original Message-
From: Michael Grunditz [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 26, 2002 3:39 PM
To: [EMAIL PROTECTED]
Subject: [ql-users] recursive delete


Hi

How do I do a recursive delete in qdos ?


/Michael
This email is intended only for the use of the addressees named above and
may be confidential or legally privileged.  If you are not an addressee you
must not read it and 

Re: [ql-users] recursive delete

2002-04-26 Thread Claus Graf

On Fri, 26 Apr 2002 18:07 +0100 (BST)
[EMAIL PROTECTED] (Christopher Cave) wrote:

 In-Reply-To: [EMAIL PROTECTED]
 What about using QPAC2? E.g.
 exep 'Files';'\d win1_top_'
 then F3 and Tree followed by All (F5) and delete ?

plus deleting the directories (if any real on), this can be sucking because qpac2 
cannot delete directories that conatin subfolders, what a pity that qpac2 isn't 
developed any further by TT,

Claus
 
 Christopher Cave
 



Re: [ql-users] recursive delete

2002-04-26 Thread P Witte

Michael Grunditz writes:

 How do I do a recursive delete in qdos ?

With extreme care!! Requires TK2.

Per

1 REMark  Example: CLS: DELETE_DIRECTORY 'ram2_', 'topdir', 1
2 :
10 REMarkDELETE_DIRECTORY
11 REMark S*BASIC PROCedure to delete an
12 REMark entire directory tree
13 REMark   Requires tk2 or equivalent
14 REMark  P Witte 1998
15 REMark Use at own risk! No warranties!
16 REMark Parameters:
17 REMark  dev$ = device; eg win1_, ram2_
18 REMark  dir$ = directory; eg temp_
19 REMark  tree:  0: files in this dir only
20 REMark   0: all sub-dirs and files
21 :
1000 DEFine PROCedure DELETE_DIRECTORY(dev$, dir$, tree)
1010 LOCal c%, t%, pos, ch%(18), n$(36)
1020 n$ = dir$: c% = 0
1030 REPeat dir_loop
1040  ch%(c%) = FOP_DIR(dev$  n$)
1050  IF ch%(c%)  0: Action 'Error', ch%(c%)
1060  pos = -64
1070  REPeat file_loop
1080   pos = pos + 64
1090   IF pos = FLEN(#ch%(c%)) THEN
1100n$ = FNAME$(#ch%(c%)): CLOSE#ch%(c%)
1110IF tree: Action 'Deleting', 1
1120c% = c% - 1: IF c%  0: EXIT dir_loop
1130pos = INT(FPOS(#ch%(c%)) / 64) * 64
1140   ELSE
1150GET#ch%(c%)\ pos + 14; n$
1160IF LEN(n$)  0 THEN
1170 BGET#ch%(c%)\ pos + 5; t%
1180 IF t% = 255 THEN
1190  IF tree THEN
1200   Action 'Checking', 2
1210   c% = c% + 1: EXIT file_loop
1220  END IF
1230 ELSE
1240  Action 'Deleting', 0
1250 END IF
1260END IF
1270   END IF
1280  END REPeat file_loop
1290 END REPeat dir_loop
1300 END DEFine
1310 :
2000 DEFine PROCedure Action(tx$, type)
2010 IF CODE(INKEY$(#0; 0)) = 27: CLOSE: ERT -1
2020 IF type THEN
2030  PRINT \ tx$! dev$; n$! '-'
2040  IF type  0: CLOSE: ERT type
2050  IF type = 1: DELETE dev$  n$
2060 ELSE
2070  PRINT tx$! n$
2080  DELETE dev$  n$
2090 END IF
2100 END DEFine
2110 :