| View previous topic :: View next topic |
| Author |
Message |
scotspgc Newbie
Joined: 13 Dec 2006 Posts: 4
|
Posted: Wed Dec 13, 2006 6:22 am Post subject: Working on a directory list |
|
|
I have a very spcific problem. I have a directory structure similar to below;
C:\Username1\Profile\randomdir1
C:\Username2\Profile\randomdir2
C:\Username3\Profile\randomdir3
C:\Username4\Profile\randomdir4
What I need to do is put all the directories in a list then have a command run on the "Profile" folders under each username folder, eg delete all folders or files, xcacls certain folders etc.
This is what I have been able to put together so far.
| Code: |
%%listfolder = E:\2006
%%commandfolder = Profile
LIST CREATE,1
LIST FILELIST,1,%%folderpath,D
LIST SEEK,1,0
REPEAT
Rem place command here???
UNTIL not sure how to define last item in list is reached.
LIST CLEAR,1
LIST CLOSE,1
|
Anyone have any ideas? |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Wed Dec 13, 2006 1:36 pm Post subject: |
|
|
Does this help?
| Code: | %%listfolder = E:\2006
%%commandfolder = Profile
LIST CREATE,1
LIST FILELIST,1,%%folderpath,*D
rem - Need to assign a value to %%folderpath
rem - add an asterisk (*) in front of the "D" to list directoties recursively
LIST SEEK,1,0
%d = @next(1)
REPEAT
Rem place command here???
info do something to %d
%d = @next(1)
UNTIL @not(@ok())
rem - the @next function will set @ok to false (null)
rem - when it gets to the end of the list
rem - remember, the @next function must be the last thing
rem - in the repeat loop...
LIST CLOSE,1
exit
|
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
scotspgc Newbie
Joined: 13 Dec 2006 Posts: 4
|
Posted: Wed Dec 13, 2006 11:31 pm Post subject: |
|
|
Fantastic, that worked. I used the following to do what I wanted.
| Code: |
%%listpath = E:\2006
LIST CREATE,1
LIST FILELIST,1,%%listpath,D
LIST SEEK,1,0
%d = @next(1)
GOSUB showlist
REPEAT
DIRECTORY DELETE, %d\WindowsXP\*.*
%d = @next(1)
UNTIL @not(@ok())
LIST CLOSE,1
exit
REM Subroutines ---------
Rem Display List
:showlist
dialog create,Folder Paths,-1,0,220,400
dialog add,LIST,L1,5,5,210,390
dialog show
list assign,L1,1
Exit
|
One more question, I have played a little and cannot find a way to select the next item in the list dialog. I want to be able to see whish folder the script is currently working on, any suggestions? |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Thu Dec 14, 2006 12:17 am Post subject: |
|
|
Here you go:
| Code: | %%listpath = E:\2006
LIST CREATE,1
LIST FILELIST,1,%%listpath,D
LIST SEEK,1,0
%d = @next(1)
GOSUB showlist
REPEAT
DIRECTORY DELETE, %d\WindowsXP\*.*
%x = @next(L1)
%d = @next(1)
UNTIL @not(@ok())
LIST CLOSE,1
exit
REM Subroutines ---------
Rem Display List
:showlist
dialog create,Folder Paths,-1,0,220,400
dialog add,LIST,L1,5,5,210,390
dialog show
list assign,L1,1
list seek,L1,0
Exit
|
Enjoy,
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|