Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
powershell:qnd:file_operations [2022/05/13 15:04] – mgupton | powershell:qnd:file_operations [2022/10/06 20:13] (current) – mgupton | ||
---|---|---|---|
Line 8: | Line 8: | ||
~\Desktop | ~\Desktop | ||
+ | </ | ||
+ | |||
+ | === User Split-Path to get folder name === | ||
+ | <code powershell> | ||
+ | cd $(Split-Path $PROFILE) | ||
</ | </ | ||
Line 90: | Line 95: | ||
</ | </ | ||
+ | Unzip zip archives contained in another zip archive. | ||
+ | <code powershell> | ||
+ | Expand-Archive -DestinationPath .\zips ' | ||
+ | ls .\zips\ | % {Expand-Archive -DestinationPath $env:temp $_.FullName} | ||
+ | </ | ||
+ | === Create a folder with name following scheme === | ||
+ | <code powershell> | ||
+ | $suffix = 1 | ||
+ | |||
+ | while ((Test-Path " | ||
+ | $suffix += 1 | ||
+ | } | ||
+ | |||
+ | mkdir " | ||
+ | </ | ||
+ | |||
+ | <code powershell> | ||
+ | $names = @(" | ||
+ | |||
+ | $name = 0 | ||
+ | |||
+ | while ($name -lt $names.Count) { | ||
+ | if ((Test-Path " | ||
+ | break | ||
+ | } | ||
+ | |||
+ | $name += 1 | ||
+ | } | ||
+ | |||
+ | if ($name -eq $names.Count) { | ||
+ | $name = 0 | ||
+ | } | ||
+ | |||
+ | mkdir " | ||
+ | </ | ||