Skip to main content
Known Participant
April 19, 2026
Question

Unable to traverse the folder named "CC"

  • April 19, 2026
  • 1 reply
  • 33 views

I have a folder on my desktop named 'CC'. When I use this JSX code, I can't iterate through the number of files inside it, but when I change the name 'CC' to something else, it works. What could be the reason for this? Is there a solution? Thank you.

var targetFolderPath = 'C:/Users/Administrator/Desktop/CC';
var targetFolder = new Folder(targetFolderPath);

if (!targetFolder.exists) {
alert('Target folder does not exist!');
} else {
var filesInFolder = targetFolder.getFiles();
alert('Number of files found: ' + filesInFolder.length);
if (filesInFolder.length === 0) {
alert('The folder is empty!');
} else {
alert('The folder is not empty!');
}
}

 

1 reply

Legend
April 19, 2026

I can only think of two reasons -- protected filename (but my web search did not find that) or another CC folder. Or may the Admin account is verboten or doesn’t have access. 

Larry
Known Participant
April 19, 2026

thank you