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();

Similar Messages

  • 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

  • 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?

  • 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.

  • 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

  • An hour ago, I accidentally deleted a "Bookmarks" folder, and all of subfolders and hyperlinks. The lost items are not in "Trash." Are they still retrievable? JAW

    An hour ago, I accidentally deleted a Bookmarks folder, and all of subfolders and hyperlinks. The lost items are not in "Trash." Are they still retrievable? JAW

    They don't go into the Trash. Unless you have a backup prior to the deletion time it's gone.

  • 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.

  • My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    My users folder has 140GB used on it, but I cannot find where it is getting that calculation. I went through all of my folders and opened them all in an info panel, and they all come out to about 30GBs. Where is the rest of the data? -Using Mountain Lion

    First, empty the Trash if you haven't already done so.
    Use a tool such as OmniDiskSweeper (ODS) to explore your volume and find out what's taking up the space. You can delete files with it, but don't do that unless you're sure that you know what you're deleting and that all data is safely backed up. That means you have multiple backups, not just one.
    Proceed further only if the problem hasn't been solved.
    ODS can't see the whole filesystem when you run it just by double-clicking; it only sees files that you have permission to read. To see everything, you have to run it as root.
    Back up all data now.
    Install ODS in the Applications folder as usual.
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Triple-click the line of text below to select it, then drag or copy — do not type — into the Terminal window:
    sudo /Applications/OmniDiskSweeper.app/Contents/MacOS/OmniDiskSweeper
    Press return. You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up.
    I don't recommend that you make a habit of doing this. Don't delete anything while running ODS as root. If something needs to be deleted, make sure you know what it is and how it got there, and then delete it by other, safer, means.
    When you're done with ODS, quit it and also quit Terminal.

  • When setting up my hubby's new phone to itunes, I have somehow merged the 2 itunes accounts together and now itunes is not responding to my phone and all of my info has synced onto my hubby's phone wiping all of his info and adding mine...Help!!

    I have an Itunes account already set up, when setting up my hubby's new phone to itunes, I have somehow merged the 2 itunes accounts together and now itunes is not responding to my phone and all of my info has synced onto my hubby's phone wiping all of his info and adding mine...Help!!

    If her data was not backed up or synced to something, it's gone. Sorry.

  • Sync performed on new iphone 4, and all my new info (contacts, pics, etc.) GONE!  It went back to my old iphone info....  how do I get my iphone 4 info back!!??

    sync performed on new iPhone 4, and ALL my new info (contacts, pics, etc)  GONE!!  It went back to my old iPhone info... how do I get my iPhone 4 info back??  The look and everything about the phone is like I have the older version!!!  I'm sure the data was backed up... but where, and how do I retrieve!!???

    If you don't have the prior computer backup files, you may want to look at this to get your information from the phone:
    http://www.wideanglesoftware.com/touchcopy/index.php

  • HT204379 I have pointed to my pictures folder and all the pictures are 1mb in size with a lowest resolution 4416 × 3312. Why do I still get blury images in my shifting titles screen saver?

    Hello,
    I have just moved to mac and pointed my screen saver to my pictures folder and all the pictures are 1mb in size with a lowest resolution 4416 × 3312. Why do I still get blury images in my shifting titles screen saver?
    Regards,
    Jan

    finally found it
    http://lifehacker.com/5711409/how-to-search-for-hidden-packaged-and-system-files -in-os-x
    need app find any file
    link at bottam

  • Should the admin/user folder and all of its sub folders be moved to the hdd or just parts of it? (eg. picture, movies, documents)  What is the best way to go about doing this.  Also should a 2t hdd be partitioned.

    iMac with 256ssd and 2t hdd. Should the admin/user folder and all of its sub folders be moved to the hdd or just parts of it? (eg. picture, movies, documents)  What is the best way to go about doing this.  Also should a 2t hdd be partitioned.

    Yes, you can move your user directories to the HD and keep your OSX and Applications on the SSD drive.
    Whether you partition your HD or not depends on how much data you have and how you propose to use your HD.
    Are you planning to use your iMac as a Time Machine backup volume? If so, partition it off.
    Do you have huge data files, eg video, music, photos?
    How much of your 2tb drive will be "free" once it is loaded with all your data?
    A little more information is required before the optimal configuration can be recommended for your use.

  • Copy a folder and all contents to another Mac

    I have a folder of other folders and albums. I would like to copy that folder and all of its contents to another Mac. So the other Mac will see it just like I do after the copy. Same folders and albums.
    I do not want to just move the library as that would destroy what is already on the other Mac. I just want to copy the folder and all its contents in one "transfer" to another iPhoto.

    Is this Folder in the iPhoto Window?
    Use iPhoto Library Manager to move Photos/Albums/Events and associated metadata between libraries
    Regards
    TD

  • After an erroneous contacts delete on the mac, they've been removed from icloud and all the synced devices. I was able to restore the contacts from a backup, but since the iCloud version is newer than the backuped one, they are deleted every iCloud sync

    After an erroneous contacts delete on the mac, they've been removed from iCloud and all the synced devices.
    I was able to restore the contacts from a backup, but since the iCloud version is newer than the backuped one, they are deleted every iCloud sync.
    Now I have an iPhone with the contacts and iCloud deactivated, but I lost all the contacts on the Mac and the iPad.
    There is a way to tell iCloud "restart using the contacts I have on this device"?

    An iCloud backup will save the state of your Camera Roll at the time of the backup but, if you delete photos from the Camera Roll, they will not be in the next backup taken.
    If you are using the iCloud Photo Library (beta) read this FAQ which will tell you what happens when you delete photos from one of the devices sharing the Photo Library.
    iCloud Photo Library beta FAQ - Apple Support
    The relevant section is:
    How does iCloud delete photos and videos from iCloud Photo Library?
    Deleting a photo or video from your Photos app will also remove the item from iCloud Photo Library and from your iCloud storage allocation. Photos and videos you remove can be recovered from the Recently Deleted album for 30 days. After 30 days, your content will be removed from the Recently Deleted album. Photos are backed up on our servers for up to 30 days after they're deleted from the Photos app. If you need to recover these photos during that time, contact Apple Support.

  • My friend downloaded iOS 5 to his iPad from my computer and all of my info including email went onto his iPad. How do I get it off his iPad and restore his stuff back on?

    I was trying to download iOS 5 onto my friends iPad using my computer and all of my info including emails etc. synced onto his and erased all of his stuff. How can I get my stuff off of his iPad using my computer (he doesn't have one) and restore his apps etc?

    If he doesn't have a computer and had no backup for his iPad he may be SOL. The entire time that the iPad has been on the market it was designed to be used in conjunction with a computer and iTunes - where all of the content should have been stored. The update to iOS 5 changes that now, but if your friend did not have a backup on a computer he may be out of luck with regard to app data, documents, settings, some saved photos, notes, calendar entries and more.
    He can download all purchased content again as long as he uses the same Apple ID that he used to buy the content originally. You can also see if iTunes created a backup of his iPad contents on your computer from which you can restore his iPad. He will still have to download all apps, books, TV Shows, and music again. If he bought any movies, he will have to buy those again, they are not available as free downloads.
    Launch iTunes on your computer and go to Edit>Prefernces>Devices and see if there is a backup of his iPad on your computer and start there.
    But for the most part, your friend will have to start all over again - erasing all of your content - downloading all of his content - and then setting his iPad up again from scratch.

Maybe you are looking for

  • How Do I put in the same image for multiple songs on iTunes

    Hi, I know if I click on the song on "info", I am able to change the album image. Is there a way for me to select multiple songs and do a bulk change with the same image? Thanks.

  • How do I complain about the way a support issue was handled?

    I'm very grateful that a long standing and reoccuring issue with the disabling of my account seems to have been solved.  What I am NOT happy about is the email I received at the end of the long battle accusing me of violating the ITunes Store agreeme

  • Calender Notification quit after installing os 6 on 9800

    I should have left well alone!! I did a software update to os 6 and now my default calendar is missing and my notifications don't work. The only "Send Using" options available are facebook and my email address. I believe this use to have "Default" as

  • Changing FileUpload File-Extension preset ?

    Hi Everybody ! I'm new to WebDynpro for ABAP and looking for a way of replacing the "All files (.)" Setting in the ABAP FileUpload component, since I want only .xml files to be uploadable. Any Ideas ? Thanks in Advance, Cheers Michael Edited by: Mich

  • My Arch/Pekwm Setup (and you can have it too!)

    Hello Everyone, I've gotten a nice working lightweight setup going here with Arch and Pekwm (see screenshot:http://img837.imageshack.us/img837/9571 … enshot.png) and I felt like I should share the tools necessary for others to get a similar environme