• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to delete a folder with subfolders ?

Participant ,
Oct 04, 2013 Oct 04, 2013

Copy link to clipboard

Copied

Hi !

How to delete a folder in which there are both files and subfolders ?

folder.remove() not worked

TOPICS
Actions and scripting

Views

1.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Oct 04, 2013 Oct 04, 2013

Copy link to clipboard

Copied

The guide states that this will only work on empty folders… You will need to loop all the contents removing them when done remove the outer folder…

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 06, 2013 Oct 06, 2013

Copy link to clipboard

Copied

LATEST

part of scripts I'm give on this forum 🙂

var t="";

var mFolder = Folder('/c/temp/2') ;

processFolder(mFolder)

alert(t)

mFolder.remove()

function processFolder(mFolder) {

    var fileList = mFolder.getFiles()

        for (var i = 0; i < fileList.length; i++) {

        var file = fileList;

              if (file instanceof File) {

              fName = File(file.fullName)

              t = t +'\n'+ fName;

              fName.remove()

        } else if (file instanceof Folder) {

           processFolder(file);

        }

   }

        mFolder.remove()

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines