How to open the files in subfolders"photo1,photo2,photo3"
-
- Posts: 29
- Joined: Sat Jul 30, 2016 3:52 am
- Location: San Francisco
Re: How to open the files in subfolders"photo1,photo2,photo3"
That's really weird. Kukurykus' answer didn't show up until today. Glad you got it working!
Re: How to open the files in subfolders"photo1,photo2,photo3"
Yes, my answer came with delay...
bamboo, that first solution of me was quickly coded, now I have something more experienced.
It will scan more and more subfolders and won't stop the process when encounter non-graphical files.
As you see it's modiefed function of Mike Hall. Read more: viewtopic.php?f=65&t=24365
It's simplified and maybe uglified for some coders , but I hope now it's enougth understable.
In the raport of scan it says name of last file in highest folder, but as to subfolder, it will be last deepest one.
Ah, and at the end choose wich version you prefer more (with eval or function) and delete one of them.
bamboo, that first solution of me was quickly coded, now I have something more experienced.
It will scan more and more subfolders and won't stop the process when encounter non-graphical files.
As you see it's modiefed function of Mike Hall. Read more: viewtopic.php?f=65&t=24365
It's simplified and maybe uglified for some coders , but I hope now it's enougth understable.
In the raport of scan it says name of last file in highest folder, but as to subfolder, it will be last deepest one.
Ah, and at the end choose wich version you prefer more (with eval or function) and delete one of them.
Code: Select all
var allFiles = [], sFolders = []
function scanSubFolders(tFolder) {
if (!sFolders.length) sFolders[0] = tFolder
var procFiles = tFolder.getFiles()
for(var i = 0; i < procFiles.length; i++) {
if (procFiles[i] instanceof File) {if (procFiles[i].fullName.search(/\.(jpg|tif|psd|bmp|gif|png)$/i) != -1) allFiles.push(procFiles[i])}
else if (procFiles[i] instanceof Folder) {sFolders.push(procFiles[i]), scanSubFolders(procFiles[i])}
}
return arr = [allFiles, sFolders]
}
scanSubFolders(topFolder = new Folder('~/desktop/test'))
// function style:
function EQL() {return eql ? 'ile' : 'older'}
for(var i = 0; i < arr.length; i++) {
var eql = arr[i] === arr[0]
alert('Scan of ' + topFolder + '\n' + arr[i].length + ' f' + EQL() + 's\nLast F' + EQL() + ': ' + arr[i][arr[i].length - 1])
}
// eval style:
var EQL = "(eql ? 'ile' : 'older')"
for(var i = 0; i < arr.length; i++) {
var eql = arr[i] === arr[0]
alert('Scan of ' + topFolder + '\n' + arr[i].length + ' f' + eval(EQL) + 's\nLast F' + eval(EQL) + ': ' + arr[i][arr[i].length - 1])
}
Last edited by Kukurykus on Tue Aug 02, 2016 3:57 pm, edited 1 time in total.
Re: How to open the files in subfolders"photo1,photo2,photo3"
Thank you Kukurykus!!,I will lean more,thank you!!!