Remove folders in array

Hello everyone,
I am currently troubleshooting the piece of code below. When I run this script, the second while loop is causing the script to break.
The first while loop figures out which items in my project is folderItems and put those in an array but it makes sure not to put folder called "Cleaning" in there by identifying it by its ID.
The second while loop runs through once and let's me, accurately, know how many folders is about to be deleted. It then deletes the first folder in the array, then gets rid of the first element in the array so the lenght of the array shrinks. The second time through the while loop, it again lets me know how many items remain to be deleted and then it breaks on "removeFolders[0].remove();".
Any ideas whats going on?
Cheers!
var j = 1;
var removeFolders = new Array();
while (j <= app.project.numItems) {
    //alert(app.project.numItems);
    if(app.project.item(j) instanceof FolderItem && app.project.item(j).id != cleaning.id) removeFolders.push(app.project.item(j));
    //if(app.project.item(j) instanceof FolderItem && app.project.item(j) != cleaning.id) removeFolders.push(app.project.item(j));
    ++j;
while (removeFolders.length != 0){
        alert("How many folders to be removed: " + removeFolders.length);
        removeFolders[0].remove();
        removeFolders.splice (0, 1);

Hello,
i just tried your code with a dummy project (10 folders with various names, some comps with some solids), got no error, it deleted all folders except the one called 'cleaning'.
What is your error message when the script breaks ?
You can try deleting last to first, it might change something although it's not clear why it would, it's essentially the same:
while (removeFolders.length)
    alert("How many folders to be removed: " + removeFolders.length);
    removeFolders.pop().remove();
Xavier

Similar Messages

  • Pse 13 does not allow you to remove folders?

    I am trying to remove folders that are no longer on my computer from elements 13.  Is this possible?

    sfgfkhome a écrit:
    I am trying to remove folders that are no longer on my computer from elements 13.  Is this possible?
    I understand you have deleted folders from outside the organizer. As a result, you have 'missing' or 'disconnected' files in your catalog.
    There are no folders, no picture files in the organizer, only links (pointers) to the location of the files in your physical drive(s).
    What you are seeing in the left panel showing folders in the organizer is an image of the folders tree based on the files locations recorded in the catalog. Of course, the physically deleted folders (outside of the organizer, via the Explorer/Finder) are still shown, since the catalog has not been updated.
    What you have to do is to remove the links to missing files in the catalog. Use the menu File/reconnect missing files. Click on the small icon in the upper part of the dialog to open a dropdown menu; first select all, then delete all. All missing files will be deleted from the files list in the catalog.
    When the files are removed from the catalog, their folders won't appear in the left panel. As a matter of fact, you remove the files from the catalog, you don't delete folders.

  • In System Prefereneces, when I am in Desktop and Screen Saver, I am unable to remove folders. I can click the "-" and the folder appears to be gone, but when I close and then reopen System Preferences, and open Desktop and Screen Saver, the folder reappea

    In System Prefereneces, when I am in Desktop and Screen Saver, I am unable to remove folders. I can click the "-" and the folder appears to be gone, but when I close and then reopen System Preferences, and open Desktop and Screen Saver, the folder reappears in the list. I have tried deleting preferences "plist" but I am totally unable to remove the folders.

    I've seen one other report like yours, and I think the issue is caused by a bug, but I don't know what triggers it.
    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, or by corruption of certain system caches. 
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. Note: If FileVault is enabled, or if a firmware password is set, or if the boot volume is a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including sound output and  Wi-Fi on certain iMacs. The next normal boot may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin. Test while in safe mode. Same problem? After testing, reboot as usual (i.e., not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Now to remove folders from icloud drive

    Remove folders from icloud drive

    Which folders, and where are you accessing the iCloud drive, on the web, on your Mac, or on something else.

  • Cant remove folders from side menu

    I recently formated and reinstalled my mac. I backed up my user folder before formating so after the install I copied it back(following instructions from apple's web site). But now, I can't remove folders from finder's side menu. I can drag a folder from the side menu to the trash and it'll disappear but next time I open finder the folder is back in the side menu. Any ideas? Thanks.
    Nate
    MacBook Pro   Mac OS X (10.4.8)  

    If you Ctrl click on the folder you want removed in the sidebar and in the menu that pops up, you should see "Remove From Sidebar". Try that. Also, make sure you empty the Trash to make sure the folder is erased if it happened to end up there.
    Hope that helps.
    MBP 2.33GHz Intel Core 2 Duo, 2GB 667 MHz DDDR2 SDRAM   Mac OS X (10.4.8)   video iPod 30gb

  • Can't remove folders from Spotlight Privacy

    Hi there,
    I've never posted on here before so please bear with me
    I am running a 17" iMac with OSX10.9.5, 2.4 Ghz Intel Core 2 Duo, 4 GB 667 Mhz DDR2 SDRAM with over 100GB of free space.
    I am also using DropBox to sync my files with a co-worker.
    The problem: A few months ago I got access to a new database on DropBox. I didn't use it often so I added the folders to my Spotlight Privacy list but then unsynced the DropBox folder from my computer. Now I have RE-synced the original folders and have tried NUMEROUS times to remove them from the list. They disappear briefly to only reappear a few seconds later.
    I need to be able to search these folders again so this is very frustrating at the moment.
    I have tried dragging in the same folders and then removing them. I have tried dragging my hard drive into the privacy and then removing prompting the spotlight to index the computer but that doesn't seem to be working either. I tried the command sudo rm -rf /.Spotlight-V100/* in Terminal, but again. They still reappear.
    Any help would be GREATLY appreciated! Thanks so much in advance!
    https://www.pinterest.com/pin/create/extension/

    Do a backup.
    Quit the application.
    Go to Finder and select your user/home folder. With that Finder window as the front window, either select Finder/View/Show View options or go command - J.  When the View options opens, check ’Show Library Folder’. That should make your user library folder visible in your user/home folder.  Select Library. Then go to Preferences/com.apple.spotlight.plist. Move the .plist to your desktop.
    Restart, open the application and test. If it works okay, delete the plist from the desktop.
    If the application is the same, return the .plist to where you got it from, overwriting the newer one.
    Thanks to leonie for some information contained in this.

  • Remove method of array

    Implement the following method in the class Project 11 to return a new array that contains all the elements of the array a not in b.
    Public static int [] remove (int[] a, int[] b)
    For example, if the array a is {5,3,2,7,1} and the array b is {8,2,5} the remove method should return the array {3,7,1}.
    Im having trouble getting it run correctly, and i think my problem is with the remove method that i made
    //heres my code
    public static void main(String[]args) {
    int [] first = {2,5,4,1,9};
    int [] second = {5,10,8,1};
    int duplicate =0;
    for (int i = 0; i < first.length; i++) {
                   for (int j =0; j < second.length; j++){
                        if (first[i] == second[j])
                             duplicate++;
                        remove(first, second);
    System.out.println(first);
    public static int [] remove(int[] a, int []b){
    for(int i = 0; i < a.length; i++) {
    if(a[i] == b) {
    int[] c = new int[a.length - 1];
    return c;
    return a;

    im having trouble with the remove method. im suppose to return a new array that contains all the elements of the array a not in b.
    Public static int [] remove (int[] a, int[] b)
    For example, if the array a is {5,3,2,7,1} and the array b is {8,2,5} the remove method should return the array {3,7,1}.
    //heres my code
    public static void main(String[]args) {
    int [] first = {2,5,4,1,9};
    int [] second = {5,10,8,1};
    int duplicate =0;
    for (int i = 0; i < first.length; i++) {
    for (int j =0; j < second.length; j++){
    if (first == second[j])
    duplicate++;
    remove(first, second);
    System.out.println(first);
    public static int [] remove(int[] a, int []b){
    for(int i = 0; i < a.length; i++) {
    if(a[i] == b) {
    int[] c = new int[a.length - 1];
    return c;
    return a;

  • Lightroom 2.6 Randomly removing folders

    Today I noticed that 3 of my folders had been removed from Lightroom.  There were still on my computer.  I had already done many, many edits to most of the pictures and then the folders just disappeared!  I had to re-import and of course the edits are all erased.  I had already gone through the files and deleted (removed from disk, not LR) the ones I didn't want, even emptied my trash and when I had to re-import all those files were back!
    Is there a way to get the files back into LR without re-importing them and hopefully recovering my edits.
    Frustrating!!!!
    Why????

    not sure why directories are deleted. Are you sure u enable the right button (delete from disk/remove from lightroom)?
    Lost your edits... when a pic is removed from lightroom (but still is on disk) that pic is removed from the database, including your edits. Always write your edits to a sidecar file (xmp files). after finishing your edits use ctrl_s to do so. That way you can retrieve the settings from the sidecar if you  have to reimport your pics.There is a way to automatically let LR write changes to xmp's. HAve a look at your settings!

  • Remove Entry from Array

    Hi,just another question. Is it possible to remove an entry inside an Array without splitting up by using SubSet und with a combine after that? I found no function for that way...RegardsHenrik

    Henrik Skupin wrote:
    > Hi,
    >
    > just another question. Is it possible to remove an entry inside an
    > Array without splitting up by using SubSet und with a combine after
    > that? I found no function for that way...
    The new LabVIEW 6i has a "Delete from Array" VI that will do this more
    elegantly.
    Regards,
    John Lum

  • Removing Items From Array Collection

    Hi. I have an array collection which is made up of items
    defined in class PlayListEntry. I want to remove all the items that
    have the value of property select set to false. This is what i have
    come up with, it works fine, but only removes half the items at a
    time. I think this is because when you remove and item with
    removeitemat() it shifts the index of the items. How can i get
    around this?
    Code
    private function removeitems():void{
    for each (var ple:PlayListEntry in songCollection){
    if (ple["select"] != true){
    songCollection.removeItemAt(songCollection.getItemIndex(ple));
    }

    Here's a sample application I wrote that achieves what you're
    looking for.
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute">
    <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    [Bindable] private var medalsAC:ArrayCollection = new
    ArrayCollection([
    {Country:"USA", Gold:35, Silver:39, Bronze:29, select:true},
    {Country:"China", Gold:32, Silver:17, Bronze:14,
    select:true},
    {Country:"Russia", Gold:27, Silver:27, Bronze:38,
    select:true},
    {Country:"USA2", Gold:35, Silver:39, Bronze:29,
    select:false},
    {Country:"China2", Gold:32, Silver:17, Bronze:14,
    select:false},
    {Country:"Russia2", Gold:27, Silver:27, Bronze:38,
    select:false},
    {Country:"USA3", Gold:35, Silver:39, Bronze:29,
    select:true},
    {Country:"China3", Gold:32, Silver:17, Bronze:14,
    select:true},
    {Country:"Russia3", Gold:27, Silver:27, Bronze:38,
    select:true}
    private function filterItems():void {
    for(var i:Number = 0; i < medalsAC.length; i++){
    if(medalsAC
    .select == false){
    // => Remove item
    medalsAC.removeItemAt(i);
    // => Refresh collection so it see's new change.
    medalsAC.refresh();
    // => Start at beginning and keep looking
    i = 0;
    ]]>
    </mx:Script>
    <mx:Button x="10" y="10" label="Remove False Items"
    click="filterItems()"/>
    <mx:DataGrid left="10" right="10" top="35" bottom="10"
    dataProvider="{medalsAC}">
    <mx:columns>
    <mx:DataGridColumn headerText="Country"
    dataField="Country"/>
    <mx:DataGridColumn headerText="Gold"
    dataField="Gold"/>
    <mx:DataGridColumn headerText="Silver"
    dataField="Silver"/>
    <mx:DataGridColumn headerText="Bronze"
    dataField="Bronze"/>
    <mx:DataGridColumn headerText="Select"
    dataField="select"/>
    </mx:columns>
    </mx:DataGrid>
    </mx:Application>

  • Remove element from array

    hi
    if i have an array
    eg
    int[] array = {4,2,1,2,1};
    how to i remove the index 2 from it and create a new array?
    thanks

    You can't remove the element--an array's size is fixed at creation.
    If you want a new array, create a new one that's one element smaller, then use System.arrayCopy to copy the elements you want to keep.

  • Remove repetitions from array

    Hi
    I would like to know how to remove repeitions from a 1D array. For example, AAANNNNDDDDKLL to ANDKL.
    Also, what if the array is not sorted?
    Arjun

    I have used this one in the past.  But if anybody has a more memory effecient way to do it I would be happy to hear it.
    Attachments:
    RemoveDups.vi ‏8 KB

  • Remove item from Array

    Hi,
    Can i remove a single item in my array or remove all elements???
    Tnx all
    Beck74

    This is a quick way to remove an element. It avoids looping which avoids an ArrayIndexOutOfBounds check with every iteration. Also, arraycopy is native which means that it is very efficient and suitable for large arrays.
    public class arraytest
        public static int[] remove(int _i, int[] _a)
         int[] b = new int[_a.length-1];
         System.arraycopy( _a, 0, b, 0, _i );
         System.arraycopy( _a, _i+1, b, _i, b.length-_i );
         return b;
        public static void main(String[] args)
         int[] a = {1, 2, 3, 4, 5};
         // remove element 3
         int[] b = remove(3, a);
         for( int i=0; i<b.length; i++ ) {
             System.out.println( b[i] );
    }

  • Remove multiples from array

    Hello, 
    I am trying to remove multiples of a fundamental frequency from an array of frequency points.  One extra issue with this removal, is that the multiple of the fundamental frequency from the array may be within a range, like +/- 1k.  Any help will be greatly appreciated.
    Thanks,
    hiNi.
    Solved!
    Go to Solution.
    Attachments:
    delete rows 2.vi ‏13 KB

    Give this a try.  You want to look at the remainder and then setup a couple of ranges based on the accuracy you want.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    delete rows 2.zip ‏6 KB

  • Deactivate "insert element before / remove element" in array

    Hello guys.
    It is possible to deacitvate "insert element before / remove element" function appears after right-click on a array in the frontpanel?
    "Description and Tip" should stay.
    Thank you.
    Alex
    Solved!
    Go to Solution.

    You can customize the right-click shortcut menu to remove some application items and keep others:
    Right-click on the array (and not on the array element!) in the front panel and select Advanced->Run-Time Shortcut Menu->Edit...
    This brings up the Shortcut Menu Editor:
     Change the drop-down control from "Default" to "Custom".
     Select the "???" line in the tree control on the left.
     on the right, change the Item Type from "User Item" to "Application Item -> Description and Tip..."
     It will automatically fill in the corrent Name and Tag.
     Save the rtm either into its own file or into the control.
     LV will automatically handle application items in the control, no event case needed.
     I sometimes find the "Copy entire menu" function of the shortcut menu pretty useful if I only want to disable a few items.
    http://zone.ni.com/reference/en-XX/help/371361G-01/lvconcepts/customizing_vis/#Customizing_Menus
    -Barrett
    CLD

Maybe you are looking for

  • Critical Irish Update needed to solve black and white tv problem on G20!

    I recently had trouble with setting up tv on my Qosmio G20, I was pointed in the direction of a black and white problem that affects earlier models. The solution to the problem was to use the g20's drivers and run 2 reg files. Having done that to no

  • Invoking a BPEL process when file comes to a dir and write to DB - BPEL10g

    Hi, I am trying to create a BPEL process where it reads a file from a directory (this directory will receive a file with any name by a different process every 30 mnts or so). and this file may have multiple records, and I need to add these records to

  • Font Book and duplicates. Strange Behaviour?

    Hello, I'd like to ask a question about Font Book and font duplicates. Here is the situation. I've just installed Microsoft Office 2008 on a MacBook Pro (13') running Snow Leopard (10.6.8). After the installation is complete and all of the Office upd

  • Converter not finding CR2 files from Canon 5D III

    I installed v7.1 of the dng converter to convert CR2 files from a new Canon 5D Mark III for use in Lightroom 3.6.  However, the program does not recognize the CR2 files whether in the original folder on the camera memory card or transferred to a fold

  • Server error when calling the DatabaseController.replaceConnection() method

    <p>I am receiving the error message below when calling the DatabaseController.replaceConnection() method. Can anyone tell me what may be the cause of this? The code being executed is below the error message. </p> <p> Thank you. </p> <pre> A server er