Copy link to clipboard
Copied
Hi there,
I just want to check number of files in folder.
//Actual code to get number of files in folder in cmd.
dir /b /s /a-d "E:\\myFolder\\*.jpg\" | find /c /v ""
//modified in jsx below
var count=system.callSystem("cmd /c \"dir /b /s /a-d \"E:\\myFolder\\*.jpg\" | find /c /v \"\" \"");
Copy link to clipboard
Copied
Maybe it is easier to use the Folder.getFiles() function than performing a system call?
Not that the function returns a list of files and folders, so you need to iterate over the list and only count the ones that are acually files.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Folder.getFiles().length is too slow compared to dos command, that's why i
wanted to do this way where i have 80K image sequence in each folder.
Copy link to clipboard
Copied
It's probably the numerous nested quotation marks throwing things off. Have you tried to URI encode/ decode your string? Otherwise I'd go with Mathias suggestion, which also would be advisable in terms of cross-platform compatibility when needed.
Mylenium