Scripting: browse for data files in a folder and all subfolders below

Hello,
i'm looking for a command to search for data files (*.dat) in a folder and all subfolders below.
I checked out command DirListGet. This command only search in the declared folder and not in the subfolders below.
Anyone an idea?
I don't want to use a loop-structure for finding subfolders and browse for the data files.
Mr. Buddy

dim result : result = DirListGet("C:\tmp", "*.dat", "filename", "FullFilenamesRecursive")
dim fl : for each fl in result
MsgBox fl
Next
Works fine for me and even recursive.
Alternatively but with mucg more effort and the same result.
Option Explicit 'Forces the explicit declaration of all the variables in a script.
dim folderPath : folderPath = "C:\tmp"
dim files : files = GetFileListRecursive(folderPath)
dim fl : for each fl in files
MsgBox fl
Next
Function GetFileListRecursive(folderPath)
dim fso : Set fso = CreateObject("Scripting.FileSystemObject")
dim results : results = Array()
GetFiles fso, folderPath, results
GetFileListRecursive = results
End Function
Sub GetFiles(fso, folderPath, results)
dim folderObj : Set folderObj = fso.GetFolder(folderPath)
dim f : for Each f In folderObj.Files
if(0 = StrComp(fso.GetExtensionName(f), "dat", 1)) then
dim index : index = ubound(results) + 1
redim Preserve results(index)
results(index) = f.Path
End If
next
dim d : for Each d In folderObj.SubFolders
GetFiles fso, d.Path, results
next
End sub

Similar Messages

  • I need applescript to change all files in a folder and its subfolders ending in .xlsx changed to .xlsb

    I need applescript to change all files in a folder and its subfolders ending in .xlsx changed to .xlsb

    try something like this:
    with timeout of 3600 seconds
      -- long timeout to because the Finder is horribly slow
              tell application "Finder"
      -- collects the files from a folder called "whatever" in your user home folder
                        set xlsbFiles to every file of entire contents of folder "Whatever" of home whose name extension is "xlsb"
                        repeat with thisFile in xlsbFiles
                                  set name extension of thisFile to "xlsx"
                        end repeat
              end tell
    end timeout
    you could make a more efficient script using System Events.app, but this will get the job done with a minimum of thought.

  • Show Thumbnail of all files in a folder and its subfolders

    Hi Guys,
    I want to set the Filter Panel (Adobe Bridge CS3) to "show all items in this folder and all its subfolders" through Java script on windows.
    From UI it is possible by clicking on icon buton present in the filter panel and content panel shows the files from current folder as well as from its subfolders.
    Can any one suggest some Java script to do it?
    -P. M. Mitchell

    Any solution?
    Good Luck.
    My
    Si
    tes

  • Remove parent folder and all subfolders (custom info panels)

    I'm writing a script to help users install custom info panels in the Folder.userData + '/Adobe/XMP/Custom File Info Panels/3.0/panels' location.  I have a working script to copy files, but I also want to delete previous versions of the same info panel.   I also want to allow for the possibility that could be several older versions so I need to loop through them.  I know that I need to empty the files of a folder before it can be removed.  I can remove one instance of a ninfo panel, but not several - I'm having trouble getting the function to loop.
    For example, if I have two old info panel version to delete (myPanel_v1 and myPanel_v2) can use getFiles (myPanel*) to get an array with the names of the two parent folders:
    ~/AppData/Roaming/Adobe/XMP/Custom%20File%20Info%20Panels/3.0/panels/myPanel_v1,~/AppData/ Roaming/Adobe/XMP/Custom%20File%20Info%20Panels/3.0/panels/myPanel_v2
    What I can't do is the loop through the subfolders and their contents based on the index of this array.  Perhaps there is a completey different approach I need to take?
    The code below does remove a single instance of my custom ino panel, but I can't figure out a way to make it loop.
    var CS5panelsFolder = (Folder.userData + '/Adobe/XMP/Custom File Info Panels/3.0/panels');
    var xmask = 'myPanel*'
    var xRemove =  (Folder (CS5panelsFolder).getFiles (xmask));  // returns an array with all folders with 'VRA_beta' in the name
    for (var i = 0; i < xRemove.length; i++) var xBin = (Folder (xRemove[i]+'/bin').getFiles());
    for (var i = 0; i < xRemove.length; i++) var xLoc = (Folder (xRemove[i]+'/loc').getFiles());
    for (var i = 0; i < xRemove.length; i++) var xRes = (Folder (xRemove[i]+'/resources').getFiles());
    for (var i = 0; i < xRemove.length; i++)
        //Loop through array of xBin files and remove them
        for (var i = 0; i < xBin.length; i++) File(xBin[i]).remove();
        //Loop through array of loc files and remove them
        for (var i = 0; i < xLoc.length; i++) File(xLoc[i]).remove();
        // Loop through array of resource files and remove them
        for (var i = 0; i < xRes.length; i++) File(xRes[i]).remove();
        // remove manifest file
        for (var i = 0; i < xRemove.length; i++) File(xRemove[i]+'/manifest.xml').remove();
    for (var i = 0; i < xRemove.length; i++)
    // Remove now empty xBin folder
        for (var i = 0; i < xRemove.length; i++) Folder(xRemove[i]+'/bin').remove();
    // Remover now empty loc folder
        for (var i = 0; i < xRemove.length; i++) Folder(xRemove[i]+'/loc').remove();
    // Remove now empty resources folder
        for (var i = 0; i < xRemove.length; i++) Folder(xRemove[i]+'/resources').remove();
    // Remove now empty old version folder
        for (var i = 0; i < xRemove.length; i++) Folder(xRemove[i]).remove();
    Thanks for your help,
    Greg Reser

    I now have this code that works:
    var W = 'Base Folder Name';
    var X = Folder(W).getFiles();
    for (var Q1 = 0; Q1 < X.length; Q1++)
       if (X[Q1] instanceof Folder == true)
         var Y = Folder (X[Q1]).getFiles();
         for (var Q2 = 0; Q2 < Y.length; Q2++)
           if (Y[Q2] instanceof Folder == true)
             var Z = Folder (Y[Q2]).getFiles();
             for (var Q3 = 0; Q3 < Z.length; Q3++) File (Z[Q3]).remove();
             Folder (Y[Q2]).remove();
           else File (Y[Q2]).remove();
         Folder (X[Q1]).remove();
       else File (X[Q1]).remove();
    Folder(W).remove();

  • How do you search a folder (and all subfolders)?

    I'm trying to return a list of all .epub files located in folder called Books.  The Books folder contains about 100 different folders.  The sub folders contain either an epub or mobi file. 
    In other words, how do you search by the type - epub?
    Thanks for any help / pointers.

    Just write on the search box ".epub". Then it returns a list of with all files and path.
    You can also hit 'cmd+i' for each file details.

  • Remove permissions for a security group for all files and folders in a folder and all subfolders?

    I found a script that adds rights to files and folders.
    We need to grant administrators rights to a set of folders for a specific project.
    ChangePermissions.ps1
    # CACLS rights are usually
    # F = FullControl
    # C = Change
    # R = Readonly
    # W = Write
    $StartingDir=
    "C:\Users"
    $Principal="Administrators"
    $Permission="F"
    $Verify=Read-Host `n "You are about to change permissions
    on all" `
    "files starting at"$StartingDir.ToUpper() `n "for security"`
    "principal"$Principal.ToUpper() `
    "with new right of"$Permission.ToUpper()"."`n `
    "Do you want to continue? [Y,N]"
    if ($Verify -eq "Y") {
    foreach ($file in $(Get-ChildItem $StartingDir -recurse)) {
    #display filename and old permissions
    write-Host -foregroundcolor Yellow $file.FullName
    #uncomment if you want to see old permissions
    #CACLS $file.FullName
    #ADD new permission with CACLS
    CACLS $file.FullName /E /P "${Principal}:${Permission}" >$NULL
    #display new permissions
    Write-Host -foregroundcolor Green "New Permissions"
    CACLS $file.FullName
    When the project is over, we need to undo the changes and remove administrators permissions from the same group of folders.
    How do we change the script to remove administrators group members instead of adding?

    I'm not sure I understand how to use that example script to undo the changes in the script I posted..
    Is there  a way to just change a few lines in the first script so that it removes instead of adding the administrators group?
    This line appears to be the line that adds permissions:
    #ADD new permission with CACLS
    CACLS $file.FullName /E /P "${Principal}:${Permission}" >$NULL
    What would be the syntax to remove the  permissions
    $Principal="Administrators"
    $Permission="F"
     from files and folders in $StartingDir= "C:\Users"
    and everything below it?

  • Repl. Partioning BSO to ASO: increase of size of .dat file in temp-folder

    Hello,
    we are shifting data from a BSO Cube to an ASO cube via replicated partitioning. The partitioning takes about 50 minutes to execute.
    Size of .dat in metadata-folder: 8 mb
    Size of .dat in default-folder: 150 mb
    Size of .dat in temp-folder: 38 gb
    Does anyone have an explanation for the enormous size of the .dat file in temp-folder?
    Many thanks in advance!
    Michael

    I am doing the same BSO to ASO. My ess00001.dat in default is 1.9GB, in metadata it is 8.2MB, the OTL file in <db> is 18MB and the outline has about 10,000 members (rough guess). Our partition replication script looks like this:
    login <user> identified by <password> on <server>;
    spool on to <logfile>;
    refresh replicated partition <srcBSO_App>.<srcBSO_DB> to <tgtASO_App>.<tgtASO_db> at <server> updated data;
    Exit;
    I have a second process running in a task scheduler that is continuously updating the aggregates in the ASO cube. Perhaps that is cleaning out my temp .dat. The MaxL command it calls is:
    execute aggregate selection on database <tgtASO_App>.<tgtASO_db> based on query_data;
    Please check out the post I put on the other thread about how we run MaxL from a calc script and other thoughts on "round tripping" Planning-ASO-Planning. Another trick: Retrieve speed is dramatically improved by disabling and working around the @XREFs.

  • Browsing for a file and selecting a Virtual Machine on hyper-v

    Hi everyone, sorry if the title is a bit problematic.
    New to Powershell here, I'm trying to create a script that will let me Browse for a .vhd file, and then let me select a Virtual Machine to attach it to using SCSI attachment.
    So far I managed to attach and detach the VHD files using add-vmharddiskdrive, but using read-host I have to manually enter the address of the .vhd file every time, as well as using read-host to input the VM name.
    Is there any way to browse for the file, select it, and then run the add-vmharddiskdrive command?
    So far the script I have is this:
    $VHDLocation = Read-Host Enter VHD Location
    $VMName = Read-Host Enter VM Name
    Add-VMHardDiskDrive -VMName $VMName -Path $VHDLocation -ControllerType SCSI
    Basically I want to shorten the time it takes to manually type the vhd location and the VM name. Any way to do that?
    Sorry for long post, thanks everyone in advance, have a nice day :)

    I couldn't get the Select-fromgridview to work sadly, but after snooping around on several different forums I managed to copy-paste some codes and after some work and trial and error I got the script to work perfectly, except for one problem. When the box
    pops up to let met select a VM, it pops in the background, as in, behind the ISE itself. So I have to alt tab to see it. Is there any way to make it pop to the front?
    I'd go through the script myself but like I said I'm very new to this and honestly most of this could be Chinese for all I know.
    Again thanks in advance!
    set-executionpolicy unrestricted
    ############## The script for browsing #############
    Function Get-FileName($initialDirectory)
     [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
     Out-Null
     $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
     $OpenFileDialog.initialDirectory = $initialDirectory
     $OpenFileDialog.filter = "All files (*.*)| *.*"
     $OpenFileDialog.ShowDialog() | Out-Null
     $OpenFileDialog.filename
    } #end function Get-FileName
    ############## Sets the VHD location parameter to the selected file from above, and input VM Name  #############
    $VHDLocation = Get-FileName -initialDirectory "c:\fso"
    ############## Select a VM ######
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    [void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing") 
    $objForm = New-Object System.Windows.Forms.Form 
    $objForm.Text = "Select a Computer"
    $objForm.Size = New-Object System.Drawing.Size(300,200) 
    $objForm.StartPosition = "CenterScreen"
    # Got rid of the block of code related to KeyPreview and KeyDown events.
    $OKButton = New-Object System.Windows.Forms.Button
    $OKButton.Location = New-Object System.Drawing.Size(75,120)
    $OKButton.Size = New-Object System.Drawing.Size(75,23)
    $OKButton.Text = "OK"
    # Got rid of the Click event for the OK button, and instead just assigned its DialogResult property to OK.
    $OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK
    $objForm.Controls.Add($OKButton)
    # Setting the form's AcceptButton property causes it to automatically intercept the Enter keystroke and
    # treat it as clicking the OK button (without having to write your own KeyDown events).
    $objForm.AcceptButton = $OKButton
    $CancelButton = New-Object System.Windows.Forms.Button
    $CancelButton.Location = New-Object System.Drawing.Size(150,120)
    $CancelButton.Size = New-Object System.Drawing.Size(75,23)
    $CancelButton.Text = "Cancel"
    # Got rid of the Click event for the Cancel button, and instead just assigned its DialogResult property to Cancel.
    $CancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel
    $objForm.Controls.Add($CancelButton)
    # Setting the form's CancelButton property causes it to automatically intercept the Escape keystroke and
    # treat it as clicking the OK button (without having to write your own KeyDown events).
    $objForm.CancelButton = $CancelButton
    $objLabel = New-Object System.Windows.Forms.Label
    $objLabel.Location = New-Object System.Drawing.Size(10,20) 
    $objLabel.Size = New-Object System.Drawing.Size(280,20) 
    $objLabel.Text = "Please select a computer:"
    $objForm.Controls.Add($objLabel) 
    $objListBox = New-Object System.Windows.Forms.ListBox 
    $objListBox.Location = New-Object System.Drawing.Size(10,40) 
    $objListBox.Size = New-Object System.Drawing.Size(260,20) 
    $objListBox.Height = 80
    Get-VM | Format-List name | Out-File -filepath c:\VMNames.txt
    ${C:\VMNames.txt} = ${C:\VMNames.txt} | select -skip 2
    function Remove-Topline ( [string[]]$path, [int]$skip=2 ) {
      if ( -not (Test-Path $path -PathType Leaf) ) {
        throw "invalid filename"
      ls $path |
        % { iex "`${$($_.fullname)} = `${$($_.fullname)} | select -skip $skip" }
    (Get-Content C:\VMNames.txt) | 
    Foreach-Object {$_ -replace "Name :", ""} | 
    Set-Content C:\VMNames.txt
    Get-Content C:\VMNames.txt | ForEach-Object {[void] $objListBox.Items.Add($_)}
    $objForm.Controls.Add($objListBox) 
    $objForm.Topmost = $True
    # Now, instead of having events in the form assign a value to a variable outside of their scope, the code that calls the dialog
    # instead checks to see if the user pressed OK and selected something from the box, then grabs that value.
    $result = $objForm.ShowDialog()
    if ($result -eq [System.Windows.Forms.DialogResult]::OK -and $objListBox.SelectedIndex -ge 0)
        $selection = $objListBox.SelectedItem
        $selection
        # Do something with $selection
    $VMName = $selection.Trim()
    ############## Dismounts the VHD if it's mounted on host, and then mounts it on VHD #############
    Dismount-VHD $VHDLocation
    Add-VMHardDiskDrive -VMName $VMName -Path $VHDLocation -ControllerType SCSI
    ############## Detaches the VHD from VM and returns it to the host #############
    Add-Type -AssemblyName Microsoft.VisualBasic
    [Microsoft.VisualBasic.Interaction]::MsgBox('Press Ok when you are ready to detach the VHD', 'MsgBoxSetForeground,Information', 'Confirm')
    Remove-VMHardDiskDrive -VMName $VMname -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0
    Mount-VHD $VHDLocation 

  • Creating folders for data files on a Mac

    On a Mac platform, I am interested in trying to programically create
    folders (named by the user) for data files to be placed in. How can
    this be done? Currently, if I send a path that includes new folders
    that don't exist to the Write to Spreadsheet.vi, I get an error 7 (new
    files don't exist). However if I manually create the folders before
    executing the VI, the files are written correctly. How can I avoid this
    last step. Any help would be greatly appreciated and I thank you in
    advance.
    Jon Caldwell
    Biomedical Engineering, CSUS
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

    Figured it out...disregard message.
    Sent via Deja.com http://www.deja.com/
    Share what you know. Learn what you don't.

  • I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?

    I am thinking of buying a iPad but my main desktop machine uses Windows 7 and MS Office.  How easy or difficult is it to transfer data files between the iPad and Windows?  Are there obvious problems or the need for some form of conversion programs?
    Many thanks for any advice.
    David

    You don't need conversion programs, iTunes can copy most of your content over to the iPad via the file sharing section, and some apps also support Dropbox, email attachments, transfer via your wifi network. There are a number of apps that you can get that support Microsoft office file (microsoft don't make an app versions of their software) e.g. from Apple there are Pages (word support), Numbers (excel) and Keynote (powerpoint), and from third-parties there are apps such as Documents To Go and QuickOffice HD

  • Help required to understand the concepts for data files in tablespace

    Hi Guys!
    Conceptual understanding for data files.
    A tablespace is having 2 datafiles.
    What once the data files will get full? I know we can create data files but what if there is no space on the server for any additional file to be created?
    Do we require to make the oldest file offline and move outside the environment?
    Thanks

    782790 wrote:
    Hi Guys!
    Conceptual understanding for data files.
    A tablespace is having 2 datafiles.
    What once the data files will get full? I know we can create data files but what if there is no space on the server for any additional file to be created?
    Do we require to make the oldest file offline and move outside the environment?
    ThanksIf the datafiles are full, there is not much that you would get from the "defragmentation" of the datafiles. It would be sort of like this in the start,
    FFFFFFFFFFFFFFFFFFFFFFFFFF
    Then it will be ,
    FFFFFFFUUUUUFFFFFUUUUUU
    So what you are going to get is something like this, (if would be done),
    FFFFFFFFFFFFFUUUUUUUUUU
    So that's how the datafile would like. But that won't give you much of the space anyways still. The option to add a storage must be there with you. The file being offline wont take away the space that it has already allocated. And moreover, doing so, would also impact the access to the data that it would be storing within it.
    HTH
    Aman....

  • ITunes crashes while browsing for .ipsw files?

    Hello,
    I have been trying to update my iOS for my iPod touch 4g and iPhone 4 to 5.0 for quite some time.  My first issue was that the connection would fail or timeout every time no matter what (I'm in a country with slow internet at the moment; no way to change that), so I solved that by downloading the .ipsw files online for the respective products. Now that I have them, when I hold shift and click restore or update (i have windows 7) to browse for the files, iTunes stops working.
    the situation with it was: appcrash  objc.dll
    I've uninstalled everything apple related from my computer and re-installed it, and still no success. Short of sending to back the states, does anyone know what I could do to update my iProducts?
    Thank you.

    mmm, my son wants a video iPod for his birthday and I have been checking the 5th gen iPod forums:
    http://discussions.apple.com/category.jspa?categoryID=157

  • Change default app for DAT files as the su

    Hey
    I do a lot of work in the terminal and it's sometimes convenient to be "su" permanentely instead of login in and out of the root account. The problem is whenever I try to open a DAT file, it tries to open it with, of all the apps in my Mac, HP Photosmart or something like that -.-
    I've done the "cmd+i -> change all" several times now and it only worked for the non-root user...
    Does anyone know how to change the deafult app for DAT files as the su (maybe the command line(s) for doing so)??
    It's not like it's a life or death thing, it's just that it's a bit annoying having to constantly write "-a Microsoft\ Excel" whenever I want to open such a file (which can be several dozens of times in an afternoon and since the names of the files may change it won't suffice to 'arrow up' to the line previously used =\)
    Much appreciated

    I'll try that, thanks
    I sometimes need it 'cause of permission issues of the files...
    (E.g.,  Some file is sent to me or I'm logged as su to install something using ports and compile/run programs and the output files generated are only readable/editable as su... As I said, it's not a life/death thing, just wanted to know if anyone knew how to fix it once and for all )
    I'll post the result as soon as I've tried the proposed solution

  • Is possible search all the files in one folder and get list all with the same extension.??

    Hi,
    I would like to get, if it is possible, do searching in one determinate folder and get all the files with the same extension, For example, Give the *.pou and get all the files on one list of the files in this folder and sub-folders...
    If it is possible i would like to see any example.
    Thanks a lot, Fonsi.

    Hi Dennis,
    I got your advise, I download the openG (i had problems, and downloading directly and install one to one).
    Ok, i got but i have one problem, which i can't solve. I entry the promt  to search and put the directory to save, later i push 'Do it' and it search the files, show the paths and number, then save in the folder and finally show the window , all ok!.
    The problem is with the target path, when i want use the browse, it doesnt run properly. I want select one carpet, and it demands one file, i dont understand why??, i changed the options browse but it didnt work. Also i would like when i put one path if folder doesnt exist, directly create it and save the files, if exist copy it.
    Thanks for all!. I attached the file in lv 7.1
    Attachments:
    buscar3.vi ‏50 KB
    capture.GIF ‏48 KB

  • HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no ma

    HELP. ............Hi folks hope some one can help me please.Having a problem in Bridge I open my images in ACR,  as I open files in a folder and lets say they are labeled in yellow  they are all going back to  the camera raw default , in other words no matter what work I have done, inc cropping they  all go back to ,as they came out of camera. What on earth is happening? I am on PS CS6. I might point out everything was working normally up to  yesterday, when this first started.
    I recently changed computer to 64bit from 32bit, not sure if this causing  the problem or not. Any help would be appreciated.

    Robert,
    Would you be so kind to rephrase your question with concise, precise information and without any "let's say that" hypotheticals?  Sorry, I can't quite follow you.
    Also please give exact versions of Photoshop CS6 (13.what.what), of Bridge and of your OS.
    Thanks.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

Maybe you are looking for

  • Help! When I select "Phone" it tries to open and gives me a white screen and closes. I cannot view my missed calls or voicemails.

    If anyone knows anything about this... When I select "Phone" on my home screen the iPhone attempts to open it, brings up a white screen and then will shut back down. I have 8 missed calls or voicemails yesterday and I couldn't check any of them. Does

  • ALV  Top_of page and Top_of_list

    hi friends.. in alv, what are the events available, where can i see that.. in Alv, what is diff bt top_of_page and top_of_list and end_of_page and end_of_list.. can you explain and send me sample prg thanks in advance

  • No more .doc conversion in iPad Pages 2.0 / iOS 7?

    I have an ongoing need to e-mail Pages documents from my iPad as Word (.doc) files to recipients who cannot work with Word 2007 (.docx) files. That was never a problem before, when Pages for iPad used the .doc format, which any MS Word user could see

  • CS5 Won't Export to .swf in spreads

    I know there's something simple I'm missing here, but I'm tired and under deadline and need help. In ID CS4, I could export spreads to .swf.  In ID CS5, I'm not seeing that option in the export box and consequently, my books are coming up with single

  • Upgrade from cs6 to cc

    Hello World I am a student and I got After effects cs 6 in the creative suite 6 production premium for like 400 bucks. I want to upgrade after effects and i asked myself if there is special pricing for students available. ... also I dont know what a