Sign in to follow this  
Followers 0
Orca

Dir Contents

7 posts in this topic

How can I select C:\ and return two arrays

$dirs[0] containing # of entries

$dirs[1-n] containing dir names

$files[0] containing # of entires

$files[1-n] containing file names

I'm trying to build a script that generates a file listing a systems contents in a tree format. If its been done please direct :)


I AM ORCA!! A VERY POWERFUL WHALE!!!

Share this post


Link to post
Share on other sites



I guess you could do something with CMD, Run it in a hidden window, type "Dir" and pipe it out to a file? or if you have the latest beta you can use stdout().


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

CMD is dissabled on the computer I'm interested in running this. The reason for the script is that I'm disallowed from the C:[local] as a user, but autoit can access it just fine. Since I can't normally walk in and view contents I need something that can do it for me.


I AM ORCA!! A VERY POWERFUL WHALE!!!

Share this post


Link to post
Share on other sites

Same, I made something exactly the same as this, I didnt have access to C:\ Drive. I created a "File Viewer" in VB but I dont know how to emulate this in AutoIt :).


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

1) Have you seen the DirGetSize function (notice the flag 1 option)

2) There is also the DOS "tree" command...

Run(@ComSpec & " /c tree C: /F") ;visually verify the command works

Run(@ComSpec & " /c tree C: /F > C:\OutputOfTree.txt") ;redirect to file


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

How can I select C:\ and return two arrays

$dirs[0] containing # of entries

$dirs[1-n] containing dir names

$files[0] containing # of entires

$files[1-n] containing file names

I'm trying to build a script that generates a file listing a systems contents in a tree format. If its been done please direct :)

<{POST_SNAPBACK}>

I'll leave filling the arrays to you, but here is a sample calling out to the FileSystemObject using the ObjCreate function in the new release available from the Developer forum:

$fso = ObjCreate("Scripting.FileSystemObject");Instantiate FileSystemObject
$rootFolder = "C:\"
$root = $fso.GetFolder($rootFolder) 
$subs = $root.SubFolders; Create SubFolders Collection
ConsoleWrite("There are " & $subs.count & " folders in " & $rootFolder & @CR)
For $fol in $subs; Loop through each subfolder in folder collection
    ConsoleWrite(@TAB & $fol.name & " has " & $fol.files.count & " files" & @CR)
    If $fol.name = "System Volume Information" then ContinueLoop; Special folder, skip
    $files = $fol.Files; Create files collection in subfolders
    For $file in $files; Loop through files in folders
        ConsoleWrite(@TAB & @TAB & $file.name & " (" & $file.size & " bytes)" & @CR)
    Next
Next

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0