To use a wildcard with Compress-Archive, you must use the -Path parameter instead, as -LiteralPath does not accept them.Ībove, we covered how to include the root directory and all of its files and subdirectories when creating an archive file. When you use the character, you can exclude the root directory, compress only files in a directory, or choose all files of a specific type. The Compress-Archive cmdlet lets you use a wildcard character (*) to expand the functionality even further. PowerShell takes everything inside of the root directory and compresses it, subfolders and all. In the previous example, we put the path to a directory with multiple files and folders in it without specifying individual files. Alternatively, to zip the entire contents of a folder-and all of its subfolders-you can use the following command, replacing and with the path to the files you want to compress and the name and folder you want it to go to, respectively: Compress-Archive -LiteralPath -DestinationPath
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |