Welcome, Guest. Please login or register.

Author Topic: How to Delete a files recursively w/ wildcards?  (Read 5199 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline marcfrick2112Topic starter

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 811
    • Show only replies by marcfrick2112
How to Delete a files recursively w/ wildcards?
« on: April 26, 2011, 09:16:11 PM »
Hey everyone, First , sorry I have been MIA for some time, it's been a rough year for me.

OK, I know one of the UK Amiga magazines posed something like this as a question for readers:

How would I, for example, Delete every icon in a directory , including in all sub-directories?
I know ' DELETE #?.info will delete all icons in that dir...

And why do I need this? Cuz I have a few CD's of MODS and .midi files that were made 'idiot-proof' and all have little scripts and icons... all I want are the &*#^@*%?! .mid and .mod files!

Help me, Amiga sages...

:afro:
---------------
Marc Frick
---------------
A1200T / \'060, 256MB, CD-R, OS3.9
A4000 w/ WarpEngine / 82MB , OS3.1
A4000 16MB, OS 3.9
A1200 , \'030 / 10MB
A1200 (stock)

CD32 :)

...And a very sick 4000T
 

Offline Mizar

  • Jr. Member
  • **
  • Join Date: Oct 2009
  • Posts: 76
    • Show only replies by Mizar
Re: How to Delete a files recursively w/ wildcards?
« Reply #1 on: April 27, 2011, 04:57:40 AM »
Firstly, make sure you're either in the directory you want to delete all .infos recursively from (current directory), or add the path before your #?.info.  For example, the command "delete dh2:mods/#?.info all".  This will delete all .info files in every nested subdirectory within the "dh2:mods" directory.  If any of them have the "d" protection bit missing, they won't be deleted, and it will report so.  In this case, use "delete dh2:mods/#?.info all force".
Amiga Tech. A1200: Apollo 1230/40 MHz & 882/50 MHz, 32 MB fast RAM, WD 298 GB HD (320 SI GB), Sony 1760 KB floppy, Surf Squirrel SCSI-II & buffered  serial, Ricoh CDRW 6x4x24, USR 33.6 Kbps modem, MV1200 scan doubler, Compaq 17" SVGA, KS 3.1, OS3.9 BB1, Genesis 45.7, Miami 3.2b, AWeb 3.5.09 APL

C= A500: 68000, 512 KB chip, 512 KB fast, 880 KB floppy x 2, 1084S, KS 1.3, OS 1.3
 

Offline marcfrick2112Topic starter

  • Hero Member
  • *****
  • Join Date: May 2003
  • Posts: 811
    • Show only replies by marcfrick2112
Re: How to Delete a files recursively w/ wildcards?
« Reply #2 on: April 27, 2011, 05:26:53 AM »
Mizar, Thanks for trying, but.... That command works for the main DIR but doesn't recurse into sub-directories.. I thought it had something to do with an odd usage of the LIST command....

Help me Obi-wan Kenobi, you're my only hope,,'
:laughing:

*sigh*
---------------
Marc Frick
---------------
A1200T / \'060, 256MB, CD-R, OS3.9
A4000 w/ WarpEngine / 82MB , OS3.1
A4000 16MB, OS 3.9
A1200 , \'030 / 10MB
A1200 (stock)

CD32 :)

...And a very sick 4000T
 

Offline mpiva

  • Sr. Member
  • ****
  • Join Date: Aug 2003
  • Posts: 297
    • Show only replies by mpiva
    • http://members.shaw.ca/michpiva
Re: How to Delete a files recursively w/ wildcards?
« Reply #3 on: April 27, 2011, 06:20:05 AM »
I think you can do:

delete dh2:mods/#?/#?.info all


Edit: Nope. Just did some testing. This will only delete the .info files in all subdirectories but not the ones in the subdirectories of those subdirectories. You might be right about needing to use LIST along with the LFORMAT option.
« Last Edit: April 27, 2011, 06:43:38 AM by mpiva »
-- Michael A. Piva --


"In engineering, there is no single truth, no one right answer; there\'s a canvas, and you paint it your way, only with chips or gates or subroutines rather than actual paint. That\'s the Amiga..."
-Dave Haynie
 

Offline Mizar

  • Jr. Member
  • **
  • Join Date: Oct 2009
  • Posts: 76
    • Show only replies by Mizar
Re: How to Delete a files recursively w/ wildcards?
« Reply #4 on: April 27, 2011, 06:54:29 AM »
Quote from: marcfrick2112;633846
Mizar, Thanks for trying, but.... That command works for the main DIR but doesn't recurse into sub-directories.. I thought it had something to do with an odd usage of the LIST command....

Help me Obi-wan Kenobi, you're my only hope,,'
:laughing:

*sigh*


Oh, you're right.  That command doesn't work very well.  Yes, you have to use LIST LFORMAT to create a short script.  This will work, try this:

list dh2:mods all sub .info lformat "delete %p%n" >ram:delinf

(where dh2:mods again is your directory where you want to delete the .info files.)

Then "execute ram:delinf".  Just look and make sure the full path in the script file (ram:delinf) is correct before you delete the wrong directory.
« Last Edit: April 27, 2011, 07:08:06 AM by Mizar »
Amiga Tech. A1200: Apollo 1230/40 MHz & 882/50 MHz, 32 MB fast RAM, WD 298 GB HD (320 SI GB), Sony 1760 KB floppy, Surf Squirrel SCSI-II & buffered  serial, Ricoh CDRW 6x4x24, USR 33.6 Kbps modem, MV1200 scan doubler, Compaq 17" SVGA, KS 3.1, OS3.9 BB1, Genesis 45.7, Miami 3.2b, AWeb 3.5.09 APL

C= A500: 68000, 512 KB chip, 512 KB fast, 880 KB floppy x 2, 1084S, KS 1.3, OS 1.3
 

Offline Thomas

Re: How to Delete a files recursively w/ wildcards?
« Reply #5 on: April 27, 2011, 10:32:26 AM »
Quote from: marcfrick2112;633769
Hey everyone, First , sorry I have been MIA for some time, it's been a rough year for me.

OK, I know one of the UK Amiga magazines posed something like this as a question for readers:

How would I, for example, Delete every icon in a directory , including in all sub-directories?
I know ' DELETE #?.info will delete all icons in that dir...

And why do I need this? Cuz I have a few CD's of MODS and .midi files that were made 'idiot-proof' and all have little scripts and icons... all I want are the &*#^@*%?! .mid and .mod files!

Help me, Amiga sages...

:afro:


list >ram:script all files p=#?.info lformat="delete *"%p%n*""
execute ram:script