Page 1 of 1

I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 2:08 am
by TMcD
When using FileList, how to I exclude "Hidden Files" ?

I don't see an option or some sort of RegEx I can do in there.

FileList "[folder]\*.png" "Files" "[slidefiles]"

This picks up 2 files, when I only want the "visible", "non hidden" file(s):

._Slides.001.png
Slides.001.png

I am expecting to only get:

Slides.001.png

Thanks

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 2:49 am
by dec
Hello,

If you like considerer to use the npFind plugin, which allow you to search for files and folders using lot of options, including search for file mask plus file attributes. I modified a bit one of the plugin included samples to shown you how to skip hidden files from the search results.

Image

Download the sample and compiled application from this link:

http://neoplugins.com/Humm/Sites/Main/V ... nFiles.zip

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 8:48 am
by dpayer
David Esperalta has a more elegant solution than I do but if you want to use only NB actions you can use FileList to get a list of all the files in the folder with the criteria you have (example *.png) and then create a subroutine to check for their attributes using either a batch file or a VB function.

example (not tested):

Code: Select all
FileList "[path]" "Files" "[myfilelist]"
If "[myfilelist]" "<>" ""
    StrParse "[myfilelist]" "[#13]" "[myfiles]" "[numfiles]"

    Loop "1" "[numfiles]" "[WILL]"
.determine the file attribute using the attrib command line utility - port to the clipboard
.use compound variable to determine the file being looked at
        Run "cmd.exe" "/c [#34] attrib [myfiles[WILL]] | clip[#34]"
        SearchStr "[clipboard]" "H        " "[foundHAttr]"
            If "[foundHAttr]" "<>" "0"
. we didn't find the hidden attribute
                Endloop
            Else
.set this line in the myfiles variable to empty
            SetVar "[myfiles[WILL]]" ""
            StrReplace "[myfiles]" "[myfiles[WILL]][#13]" "" "[myfilelist]" ""
            Endif
    Endloop
Endif

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 9:42 am
by virger
In that case I use this:
I hope you serve.

Run "Dir" "[PubDir]*.* /a-h > [PubDir]Lista" "RunOnce+Wait+LoadComplete+Minimized+Hidden" "" ""
FileRead "[PubDir]Lista" "All" "[lista]"

PURA VIDA
COSTA RICA
BRAZIL-2014

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 1:48 pm
by TMcD
Thanks guys, I went ahead and made my own workaround....

This should be part of native NeoBook, since 99.9999999999999999999999999999999999999999999% of the time I'm sure people want the "actual" files and not the (hidden) ones windows makes for a reference, or whatever those files are.

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 2:10 pm
by dec
Hello,

TMcD wrote:Thanks guys, I went ahead and made my own workaround....

Share with us so anyone can know another possible way.

Re: I don't want "Hidden Files" ... ?

PostPosted: Mon Jun 09, 2014 2:36 pm
by TMcD
It's not just the routine itself, (as it has other things specific to the app)... but you'll get the idea:

Code: Select all
... Get the list of slide names
FileList "[folder]\*.png" "Files" "[slidefiles]"
... Extract the slide file names
StrParse "[slidefiles]" "[#13]" "[tempslide]" "[tempnumberofslides]"
... Remove any system files like ._Slide1.png
Loop "1" "[tempnumberofslides]" "[loop]"
SearchStr "._" "[tempslide[loop]]" "[hiddenfile]" ""
... This means we found a regular image file
If "[hiddenfile]" "=" "0"
... Update counter, because [tempnumberofslides] can be inaccurate to what I need.
SetVar "[count]" "[count]+1"
... Add the "non-hidden" image to the list of images
SetVar "[slide[count]]" "[tempslide[loop]]"
EndIf
EndLoop

Re: I don't want "Hidden Files" ... ?

PostPosted: Tue Jun 10, 2014 10:51 am
by Neosoft Support
Why do you have hidden png files?

Re: I don't want "Hidden Files" ... ?

PostPosted: Thu Jun 12, 2014 11:46 pm
by TMcD
Neosoft Support wrote:Why do you have hidden png files?


Good question...
I call them hidden files, as they seem to be some sort of reference file or something Windows creates.

I have my folders set to show "hidden files", so there is for example a "hidden" file for each image, as in:

slide.png (real file)

windows created "hidden file is shown in the folder:

._slide.png

Troy

* The setting in windows is: Folder Options > Hidden files and folders > (X) Show hidden files, folders and drives

P.S. I am guessing that the average user wouldn't need this routine, because "hidden" files are not seen, thus not seen by NeoBook and not needing to be handled by NeoBook. Am I right?

Re: I don't want "Hidden Files" ... ?

PostPosted: Fri Jun 13, 2014 10:06 am
by Neosoft Support
windows created "hidden file is shown in the folder:

._slide.png


I haven't heard of Windows creating hidden files like that before. Maybe they were created as a backup by the program you used to generate the png images? I think this is unusual behavior.

* The setting in windows is: Folder Options > Hidden files and folders > (X) Show hidden files, folders and drives

P.S. I am guessing that the average user wouldn't need this routine, because "hidden" files are not seen, thus not seen by NeoBook and not needing to be handled by NeoBook. Am I right?


NeoBook doesn't recognize the show hidden files setting in Windows.

Re: I don't want "Hidden Files" ... ?

PostPosted: Fri Jun 13, 2014 12:23 pm
by TMcD
I just found out that they are MAC OSX reference files.

I'm running NeoBook on a MAC with WIndows 7 installed on Parallels.

Ya learn something every day.

Thanks,
Troy