Skip to content
⌘ NSIS Forum Archive

Possibility to ignore files within "File /r option"

50 posts

rsegal#
Ok this version should solve the directory recreation issue in the installing folder. Given a folder "c:\temp" that has many subfolders say, folder1, folder2, folder3, ..., folderN these folders will be created in the installtion directory as $OUTDIR\folder1, $OUTDIR\folder2 rather than dumping everything into $OUTDIR as it was doing before.
Mosestycoon#
Dear rsegal -

I gave your latest FolderList a try, but still without success. Ok perhaps I am doing it wrong, so here is what I did:
!macro FOLDER_LIST_RECURSIVE INCLUDE_DIR EXCLUDE_FILES
!system "FolderList.exe /r $\"${INCLUDE_DIR} $\" $\"${EXCLUDE_FILES}$\""
!include "FolderList.exe.txt"
!macroend

!insertmacro FOLDER_LIST_RECURSIVE "${NSISDIR}\TSW\*.*" "CVS\*.*"
(Still the part I've mentioned above)

This time, I get another compilererror:
!insertmacro: FOLDER_LIST_RECURSIVE
!system: "FolderList.exe /r "C:\Programme\NSIS\TSW\*.* " "CVS\*.*""
!system: returned 0
!include: "FolderList.exe.txt"
Push: $OUTDIR
Error: Can't add entry, no section or function is open!
!include: error in script: "FolderList.exe.txt" on line 1
Error in macro FOLDER_LIST_RECURSIVE on macroline 2
If I take a closer look to the generated file FolderList.exe.txt (Line 1-11 which are mentioned to be the faulty line), it is showing the following lines:
Push $OUTDIR
CreateDirectory "$OUTDIR\DB"
SetOutPath "$OUTDIR\DB"
Pop $OUTDIR
Push $OUTDIR
CreateDirectory "$OUTDIR\DB\CVS"
SetOutPath "$OUTDIR\DATENBANK\CVS"
File "C:\Path\to\NSIS\TSW\DB\CVS\Entries"
File "C:\Path\to\NSIS\TSW\DB\CVS\Entries.Extra"
File "C:\Path\to\NSIS\TSW\DB\CVS\Repository"
File "C:\Path\to\NSIS\TSW\DB\CVS\Root"
Any ideas?
Mo
rsegal#
Sounds like you are calling my program outside of a section or function. As it mentioned from your error you cannot call "Push $OUTDIR" outside a section. You also cannot make a call to "File" outside of a section or function.
deguix#
I not tested this plugin yet, but have "maybe" a simpler way to do these things with some useful NSIS commands... (remembering...)

Quote from Kichik
This program can even be a simple installer using FindFirst, FindNext and FindClose.
Isn't? (Kichik and your really useful tips...)
Vytautas#
A new bug in the latest version of your program. It is a little difficult to describe so I will attach directory tree snapshots the dir.txt file contains the source directory and dir1.txt contains the target directory produced by the installer. {NOTE: No files were actually excluded in this script.}

Because the files in your program are sorted in alphabetical order files in the root directories get placed in subdirectories is they come after a folder in the sorting order.

Vytautas 😱
Vytautas#
I have noticed that you include a CreateDirectory command before SetOutPath, this is not needed as SetOutPath creates the path if it does not exist.

Vytautas 😉
rsegal#
Originally posted by deguix
I not tested this plugin yet, but have "maybe" a simpler way to do these things with some useful NSIS commands... (remembering...)

Quote from Kichik
This program can even be a simple installer using FindFirst, FindNext and FindClose.

Isn't? (Kichik and your really useful tips...)
Sure you could probably do the same thing with those script calls. I'm doing it with the same Win32 calls in C++. NSIS is definitely nice but I've been using C/C++ alot longer than I've been working with NSIS. It's what I'm most proficient and comfortable with. That's why I chose it.
rsegal#
Originally posted by Vytautas
I have noticed that you include a CreateDirectory command before SetOutPath, this is not needed as SetOutPath creates the path if it does not exist.
Well therer you are, you learn something everyday.

Originally posted by Vyatautas
Because the files in your program are sorted in alphabetical order files in the root directories get placed in subdirectories is they come after a folder in the sorting order.
I don't recall having that problem however I'll be sure to check it out. Thanks again for the feedback, it helps alot!
Mosestycoon#
Originally posted by rsegal
Sounds like you are calling my program outside of a section or function. As it mentioned from your error you cannot call "Push $OUTDIR" outside a section. You also cannot make a call to "File" outside of a section or function.
Okay, so I have to call it in every section like:
Section "1" sec1
!insertmacro FOLDER_LIST_RECURSIVE "${NSISDIR}\Path\to\Section1\Dir\*.*" "CVS\*.*"
...
SectionEnd

Section "2" Sec2
!insertmacro FOLDER_LIST_RECURSIVE "${NSISDIR}\Path\to\Section2\Dir\*.*" "CVS\*.*"
...
SectionEnd
Is that correct rsegal?
Thx for your great engagement and support 👍 (That's why the community lives...)

Mo
rsegal#
Originally posted by Mosestycoon
Okay, so I have to call it in every section like:
Section "1" sec1
!insertmacro FOLDER_LIST_RECURSIVE "${NSISDIR}\Path\to\Section1\Dir\*.*" "CVS\*.*"
...
SectionEnd

Section "2" Sec2
!insertmacro FOLDER_LIST_RECURSIVE "${NSISDIR}\Path\to\Section2\Dir\*.*" "CVS\*.*"
...
SectionEnd
Is that correct rsegal?

Mo
Yep, that's right. You can make both calls in the same section or in separate sections like you've got.

Originally posted by Mosestycoon
Thx for your great engagement and support 👍 (That's why the community lives...)
Your welcome
deguix#
rsegal
Sure you could probably do the same thing with those script calls. I'm doing it with the same Win32 calls in C++. NSIS is definitely nice but I've been using C/C++ alot longer than I've been working with NSIS. It's what I'm most proficient and comfortable with. That's why I chose it.
Hmmmm... I was examining it and forgot something: "Compile Time is different than Run Time" if was a code for it, has to be in Run Time (File command is in Run Time). Yeah, now I realize, have to use it with plugins...

This DLL have an installation? I tried it and I could't use it. Maybe putting only the DLL and the readme in the Zip.

(Out of subject, I tried to download instdrv.zip from Archive, and give an error saying:

Error: The file you requested could not be found!)
rsegal#
Originally posted by deguix
This DLL have an installation? I tried it and I could't use it. Maybe putting only the DLL and the readme in the Zip.
I'm not sure you could do it with plugins. Pugin calls are run at run-time not at compile time. My program is a standalone executble called using the "!system" command. See messages posted further back in the discussion for examples of it's use and where to download it.
kichik#
Originally posted by deguix
Error: The file you requested could not be found!)
Thanks, fixed.
deguix#
Hmmmm... ... have to use it with plugins...
I said about the command "File" here. Inclusion inside program package compiling is not possible. (since will give a error that a variable (example) don't exist, when doing the code)

I'm not sure you could do it with plugins. Pugin calls are run at run-time not at compile time. My program is a standalone executble called using the "!system" command. ...
I tried the program inside the .zip file. Give error about Kernel32.dll, laking a function. I'm using Win95, without latest updates (fear of giving problems, NOW). And it's only a comment, don't worry much about it.
rsegal#
Should have an updated version sometime by the end of this week. Sorry for the delay you guys have been giving some good feedback, just want to make sure I get all the errors I can out of the program before I send it out.
rsegal#
Ok I've got a new version to try out. A few notes on its use. Empty directories are not included when recursing. If this is an issue for anyone let me know and I will look for solution. Any files, folders you want to ignore will be ignored in all folders. So for example
!insertmacro FOLDER_LIST_RECURSIVE "C:\\MyFolder\\*.*" "\\CVS\\," 
will ignore all CVS folders under "c:\MyFolder" and it's subfolders. Notice in the example you must prefix the folder to ignore with a "\" character. If you are ignoring a folder a the last item in your ignore list it will require a comma after the prefixed backslash as in the example. If you do not have a folder as your last ignore item this is not a problem.
!insertmacro FOLDER_LIST_RECURSIVE "C:\\MyFolder\\*.*" "\\CVS\\,*.txt" 
Sorry about the being specific about the backslashes and commas, I will be fixing this eventually.
Vytautas#
Great, 😁 it worked like a dream. I noticed one little problem however.

This command did not exclude all of the zip files from the updates directory.
!insertmacro FOLDER_LIST_RECURSIVE "C:\Program Files\Spybot - Search & Destroy\*.*" "SDHelper.dll,Updates\*.zip"
I'm not sure if its just the wildcards in subdirectories or wildcard full stop that don't work.

Vytautas
rsegal#
Originially posted by Vytautas
Great, it worked like a dream.
Always nice to hear. Thanks!

Originally posted by Vytautas

This command did not exclude all of the zip files from the updates directory.

code:

!insertmacro FOLDER_LIST_RECURSIVE "C:\Program Files\Spybot - Search & Destroy\*.*" "SDHelper.dll,Updates\*.zip"
Yeh it's not setup to properly deal with the format "Updates\*.zip" as a parameter right now. I took that feature out temporarily. To exclude zip files from the updates subfolder right now you will need to use,
!insertmacro FOLDER_LIST_RECURSIVE "C:\\Program Files\\Spybot - Search & Destroy\\*.*" "\\Updates\\,SDHelper.dll"
!insertmacro FOLDER_LIST_RECURSIVE "C:\\Program Files\\Spybot - Search & Destroy\\Updates\\*.*" "*.zip" 
This will ignore the "Updates" folder on the first call and then it can be included with zip files filtered out in the next call. The next big thing I'll be looking at is how to distinguish between ignoring a single folder over ignoring all folders in a recursive structure. Suggestions for a syntax are always welcome.
tieum#
Hello,

I tried FolderList and it is efficient. Thank you for your job.

Is it still to be integrated in NSIS for 2.1 version ?
When is 2.1 version planned ?

Thank you,

Tieum