How do you archive all files (including ones without extensions) in a directory without archiving of the subdirectories using 7-zip command tool (7z.exe
)?
If I use the wildcard with a dot (*.*
) it works but only for files with extensions. Using *
(or not using the wildcard at all) does not work even with the -r-
switch (which is supposed to be then default according to the help file), since it archives everything in the source directory recursively. I just need to archive all files (some may not have extensions) in the immediate directory (no subfolders and no recursion). Any ideas?
The following commands do not work:
7z.exe a c:\output.7z c:\input -r- 7z.exe a c:\output.7z c:\input\* -r-
I am calling 7-zip from a PowerShell script, if this matters.
7-Zip will take an array of file objects for the input, so this should work:
& 7z.exe a C:\output.7z (Get-ChildItem C:\Input\* -File)