Amiga.org
Amiga computer related discussion => Amiga Tutorials => Topic started by: sim085 on October 13, 2009, 11:56:20 AM
-
Hello,
I am new to scripting and I was wondering if anyone could help me achieve this. Is there a way to create a loop that loops within every directory of a partition? For example - can I make a loop that would first traverse all directories of System: and then all directories in System:C, then all sub-directories of System:C, etc.
Regards,
Sim085
-
is this connected to changing icons ?
-
is this connected to changing icons ?
Yes - but I started a new thread because it is more related to scripting rather then changing icons (which I know how to using CLI now). I am trying to write a script that can change for everyone rather then only myself and my set-up. At the moment I am trying to backup the original icons and then I will move to the next step of copy new icons from a source directory. I will also write a restore script so that one can change from one set-up to another with relative easiness. ... although I wonder who may need this apart me :)
-
Will the cli program allow you to use wildcards ?
So you could use #?.info for instance.
I am not sure how you would loop through all the directories to do this though. I suspect you would need to supply a definite list
-
If it does not allow wildcards, you can use the List command to call the program for each file:
list >ram:scriptfile work:dirname all files p=#?.info lformat="changeicon *"%p%m*" xyz"
execute ram:scriptfile
-
If it does not allow wildcards, you can use the List command to call the program for each file:
list >ram:scriptfile work:dirname all files p=#?.info lformat="changeicon *"%p%m*" xyz"
execute ram:scriptfile
I was going to suggest something using pipes but wasnt sure how you would then call the program for each one.
Good to learn some of this stuff.
-
Will the cli program allow you to use wildcards?
I just tried that out but does not seem to work. If it does not allow wildcards, you can use the List command to call the program for each file:
Thanks :) I'll see how that peace of code works.
So it seems that script files do not support for-loops and if-statements right?
-
So it seems that script files do not support for-loops and if-statements right?
Check out the startup-sequence... see if there's an If in there. ;)
For has also been implemented by third parties in a number of instances, but not in the standard Workbench/CLI/Shell iirc.
-
Check out the startup-sequence... see if there's an If in there. ;)
For has also been implemented by third parties in a number of instances, but not in the standard Workbench/CLI/Shell iirc.
Thanks :) Yes there is an example in there! I'll see how I can use that for my script.
-
Is there a way how I can insert a return line in there? I need to insert some if statements in the generated script and I cannot do that in a single line :(
-
Hi, sorry to bring this up again, but does anyone know how to check if a file is a directory or not?
-
Hi, sorry to bring this up again, but does anyone know how to check if a file is a directory or not?
In Thomas example script, he uses the "files" parameter for the list command. This will only give a list of all files in a directory.
The "dirs" parameter for the list command will only give a list of all directories.
-
The "dirs" parameter for the list command will only give a list of all directories.
What I meant is if there is a way to check if for example Sys:A is a directoy or not. Something as follows:
IF Sys:A IS DIRECTORY
; do something
EndIF
Obviously the above code is not correct. However is there anything that can help me achieve the same?
-
Ok, I managed to do what I want using Thomas previous example and MozzerFan information about 'dirs'. I have completed by first script which takes a backup of all the current icons installed on a particular partition :) Now I'll move to the next step so that I can make an installation script! These scripts are nothing special, but when ready I'll make them available for anyone who would like to use it in any way.