forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Need a list with all dirs and files at a drive?? Check here!

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Wed Aug 14, 2002 6:11 pm    Post subject: Need a list with all dirs and files at a drive?? Check here! Reply with quote

I've made a script which makes 2 lists, one with all files in a directory, and another with all dirs in a directory

Enjoy,
Vic



Quote:
goto skip


##################################
# Files and dirs list creator #
##################################

Enjoy the script,
Vic

Pleasy report any bugs and suggestions at vic_delfant@hotmail.com





:skip
rem Change %%directory to the directory from which you want to have the list
%%directory = C:\Windows

%%dir = @shortname(%%directory)
directory change,@path(%0)
DIALOG CREATE,Files and dirs list creator +++ by Vic +++,-1,0,586,194
DIALOG ADD,STYLE,bold,,,B,,
DIALOG ADD,LIST,dirs,43,8,262,144,,sorted
DIALOG ADD,LIST,files,43,314,262,144,,sorted
DIALOG ADD,TEXT,TEXT1,27,9,,,Dirs,,bold
DIALOG ADD,TEXT,TEXT2,28,315,,,Files,,bold
DIALOG SHOW

rem Creating a msdos batch file which creates a list with all dirs and files and stores
rem them into list.txt
list create,1
list create,2
list add,1,"@echo off"
list add,1,cls
list add,1,del list.txt
list add,1,"dir %1 >> list.txt"
list add,1,"exit"
list savefile,1,list.bat
list clear,1
rem Running list.bat and loading list.txt into list 1
run list.bat %%dir
list loadfile,1,list.txt
if @equal(@count(1))
Warn Error creating list.txt @cr()Does the directory exists and are files in it?
end
rem Deleting unnecessary info like the volume name of the drive
list seek,1,0
list delete,1
list delete,1
list delete,1
list delete,1
list delete,1
list seek,1,@pred(@count(1))
list delete,1
list delete,1
list seek,1,0

%%ready =
rem This repeat-until searches for dirs and stores them into list 2 and deletes them
rem from list 1, so they can't be found twice,
repeat
if @match(1,<dir>)
%%item = @item(1)
list delete,1
list add,2,%%item
list seek,1,0
else
%%ready = 1
end
if @not(@equal(@count(1),@succ(@index(1))))
list seek,1,@succ(@index(1))
end
until %%ready

rem This piece of script selects the 'Windows' directorynames like 'Visual DialogScript'
rem instead of the dosnames like 'visual~1' and add them into the dirs list in the dialog
%%count = @count(2)
%%done = 0
repeat
%%item = @item(2)
rem If your directorynames are longer then 30 characters, adjust '74'
rem to a higher value
%%item = @substr(%%item,45,74)
if @not(@equal(%%item,"."))
if @not(@equal(%%item,".."))
list add,dirs,%%item
end
end
if @not(@equal(@count(2),@succ(@index(2))))
list seek,2,@succ(@index(2))
end
%%done = @succ(%%done)
until @equal(%%count,%%done)

rem This repeat-until selects the 'Windows' filenames like 'Big Script'
rem instead of the dosnames like 'bigscr~1' and add them into the files list in the dialog
%%count = @count(1)
%%done = 0
repeat
%%item = @item(1)
rem If your filenames are longer (including extension) then 30 characters, adjust '74'
rem to a higher value
%%item = @substr(%%item,45,74)
list add,files,%%item
if @not(@equal(@count(1),@succ(@index(1))))
list seek,1,@succ(@index(1))
end
%%done = @succ(%%done)
until @equal(%%count,%%done)
wait event
Quote:

_________________
phpBB Development Team


Last edited by Vic D'Elfant on Fri Aug 16, 2002 5:46 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Aug 14, 2002 7:43 pm    Post subject: Reply with quote

Some stuff ya might wanna check out... Wink
Code:

DIALOG CREATE,Files and dirs list creator +++ by Vic +++,-1,0,586,194
  DIALOG ADD,STYLE,bold,,,B,,
  DIALOG ADD,LIST,dirs,43,8,262,144,,sorted,CLICK
  DIALOG ADD,LIST,files,43,314,262,144
  DIALOG ADD,TEXT,TEXT1,27,9,,,Dirs,,bold
  DIALOG ADD,TEXT,TEXT2,28,315,,,Files,,bold
DIALOG SHOW

rem -- Add horizontal scroll to lists --
%z = @sendmsg(@winexists(~dirs),$0194,2000,0)
%z = @sendmsg(@winexists(~files),$0194,2000,0)

rem -- Removes duplicates --
LIST CREATE, 1, SORTED

rem -- Load dirs (drive C) --
LIST FILELIST, dirs, C:, D

rem -- Use this for list of all dirs & subdirs --
rem LIST FILELIST, dirs, C:, *D

:EVLOOP
  WAIT EVENT
  goto @event()

:dirsCLICK
  LIST FILELIST, 1, @item(dirs)\*.*
  rem -- Add system, hidden, read-only we may have missed,
  rem -- the sorted list 1 removes any duplicates.
  LIST FILELIST, 1, @item(dirs)\*.*, SHR
  LIST ASSIGN, files, 1
  LIST CLEAR, 1
  goto EVLOOP

:CLOSE
  EXIT

BTW, if ya hit the "quote" button on my post, you can see how
to use the "code" tags at the beginning and end of posted code
(you can also use "VDS" tags instead). Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Thu Aug 15, 2002 2:57 pm    Post subject: Thanx mac! Reply with quote

Thanks Mac!
Your script is a lot shorter than my one.

_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Aug 16, 2002 7:58 am    Post subject: Reply with quote

Mine's just a short example though.

BTW, if ya wanna get file names using DIR, type
dir /? at the command line and check out all the
switches. Here's a few:

/b (omits extra info)

/a:d (only shows dir names)

/a:-d (only shows file names)

Cheers, Mac

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Vic D'Elfant
Past Contributor
Past Contributor


Joined: 26 Jun 2002
Posts: 673
Location: The Netherlands

PostPosted: Fri Aug 16, 2002 5:28 pm    Post subject: Thanks mac! Reply with quote

Thanks Mac!
_________________
phpBB Development Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Aug 16, 2002 5:53 pm    Post subject: Reply with quote

No problemo... Wink
_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group