English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 08 January 2014, 11:14   #1
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Script to find orphan folders from icons

Hi guys,

I want some help in order to be able to make a script that will find from .info files if a folder doesn't have an .info file.

For example lets say I have these folders:
- 1
- 2
- 3
- 4
and the info files:
- 1.info
- 2.info
- 4.info

What I want is a script that will output me just the name of the folder "3" that doesn't have an icon.

The opposite (finding orphan .info file) is so much easier and I can check it out under DOpus by selecting all the folders and checking out which .info file is not selected.
mfilos is offline  
Old 08 January 2014, 12:59   #2
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
AmigaDOS does not have folders, it has drawers.

Code:
list all files p=#?.info lformat="if not exists *"%p%m*"*n echo %p%m*nendif" >ram:script
execute ram:script
thomas is offline  
Old 08 January 2014, 13:54   #3
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Quote:
Originally Posted by thomas View Post
AmigaDOS does not have folders, it has drawers.
, right on! Folders are a winblows thing
Bamiga2002 is offline  
Old 08 January 2014, 15:12   #4
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Fantastic idea Thomas (I was 100% sure that I'd get a response from you).
Soz about the folder thing btw.
I'm the one calling wallpapers as backdrops and I fell into the trap myself :P

Cheers
mfilos is offline  
Old 08 January 2014, 15:48   #5
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Hi Thomas, just gave it a spin and it doesn't work as intended.

My example:
I have a drawer in RAM: called Test
Inside the Test drawer there are 4 drawers named:
- 1
- 2
- 3
- 4
Also there are icons for every folder but 3
- 1.info
- 2.info
- 4.info

When I run the command inside the Test drawer I get the following script file output:
Code:
if not exists "4"
 echo 4
endif
if not exists "2"
 echo 2
endif
if not exists "1"
 echo 1
endif
Ofc, just executing the script doesn't show anything as the drawer didn't exist on the script.
Also if other drawers with icons exist recursively on any drawer, they output as well (which is not correct for what I had in mind).
mfilos is offline  
Old 08 January 2014, 17:02   #6
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Oops, sorry. Little logic error here. It does what you already can: it finds orphaned icons, not drawers without icons.

This should do the opposite:

Code:
list all dirs lformat="if not exists *"%p%n.info*"*n echo %p%n*nendif" >ram:script
execute ram:script
thomas is offline  
Old 08 January 2014, 17:41   #7
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
Here an ARexx script that does the same. However, it can easily expanded.
Code:
/* Find drawers without ".info" files script.
 *
 *     $VER: FindDrawer.rexx V0.1 (08.01.2014)
 * Function: Find drawers that do not have a ".info" file.
 * Requires: rexxtricks.library
 *    Usage: "rx FindDrawer.rexx <source>"
 *           <source> = any path
 *
 *  Example: "rx FindDrawer.rexx SYS:"
 *  Example: "rx FindDrawer.rexx Games:Adventure/"
*/

pattern = '#?'   /* AmigaDOS pattern */

PARSE ARG source . ; OPTIONS RESULTS

IF source = '' | source = '?' THEN DO
 SAY 'Usage: "rx FindDrawer.rexx <source>"'
 SAY 'Example: "rx FindDrawer.rexx Games:Adventure/"'
 EXIT
END


CALL addLibs()

IF ~GETDIR(source, pattern, 'sourceDirs', 'DIRS', 'PATH', 'SUBDIRS') THEN DO
 SAY 'GETDIR() ERROR! while reading: "'|| source ||'"'
 EXIT
END

DO i = 1 TO sourceDirs.0
 IF ~EXISTS(sourceDirs.i || '.info') THEN DO
  SAY sourceDirs.i
 END
END

EXIT

/* Check/Add libs */
addLibs:
libs = 'rexxtricks.library'
DO i = 1 TO WORDS(libs)
 IF ~SHOW('L', WORD(libs, i)) THEN DO
  IF ADDLIB(WORD(libs, i), 0, -30, 0) = 0 THEN DO
   ADDRESS COMMAND 'Run >NIL: C:RequestChoice "FindDrawer.rexx" "Can`t open" WORD(libs, i) "_OK"'
   EXIT
  END
 END
END
RETURN
daxb is offline  
Old 08 January 2014, 19:14   #8
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Thanks a lot both of you!
I'll try both and see what suits me best for my need

The reason I wanted the following script help is because I wanted to copy iGame IFF files from an archive that probably had some folders that my WHDLoad archive DIDN'T have.
I checked for example letter A and one drawer had no info (cause it changed the WHD name apparently).
To check it out firstly I exported a file via the list command and took it to EXCEL where via IF declaration found out easily. All this procedure was not fast NOR clever by any means alas I thought of asking here the experts

EDIT: Both scripts work the same. I didn't like that they both display recursively the drawers but I edited the arexx script and now it works in the first level of directory only. Thanks again

Last edited by mfilos; 08 January 2014 at 22:41.
mfilos is offline  
Old 10 January 2014, 11:33   #9
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
You could have copied the iGame IFFs as they are (all dirs), then sort your games-DRAWER(!) by size in DOPUS4 and just delete the dirs that only had the pics in it.
Bamiga2002 is offline  
Old 10 January 2014, 13:44   #10
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
True as well!
Cheers man.
mfilos is offline  
Old 10 January 2014, 17:47   #11
jPV
Registered User
 
jPV's Avatar
 
Join Date: Feb 2008
Location: RNO
Posts: 1,006
Quote:
Originally Posted by Bamiga2002 View Post
, right on! Folders are a winblows thing
I usually call them just directories, which is more universal term I think Although it's usually related to shell usage, but on most platforms at least. I never call them yucky folders and calling them workbenchish drawers can cause understanding problems
jPV is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preinstalls containing 2 folders TroelsDK project.WHDLoad 3 04 November 2013 02:26
File comments and shared folders mark_k support.WinUAE 2 06 December 2012 10:15
OS 3.5 icons on 3.1 & WHDLoad hangs when displaying icons PoulpSquad support.WinUAE 22 14 September 2012 00:57
"Orphan" colour 0 line artifact mark_k support.WinUAE 0 24 April 2012 14:01
New folders icons for XP frikilokooo Retrogaming General Discussion 0 16 November 2007 10:11

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:03.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08772 seconds with 13 queries