AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-1003800

somebadhat's questions

Martin Hope
somebadhat
Asked: 2020-03-17 15:57:44 +0800 CST

当路径可以是 50 中的任何一个时,使用 PowerShell 5 或 > 删除目录/子目录

  • 5

Windows 10 64 位。PowerShell 5.1

当路径可以是 50 个中的任何一个时,使用 PowerShell 5 或 > 删除目录/子目录。

删除livebolivar.com它的子目录any of 50 folders named mmddyy

"%USERPROFILE%\desktop\websites\"any of 50 folders named mmddyy"\livebolivar.com"

删除 %USERPROFILE%\desktop\websites\011920\livebolivar.com

发现太多:

gci %USERPROFILE%\desktop\websites -recurse | Where-Object {($_.PSIsContainer)} | Foreach { if ( $_.Name -eq "livebolivar.com") {remove-item $_.fullname -confirm}} 

不工作:

gci -exclude favorites %USERPROFILE%\desktop\websites -recurse | Where-Object {($_.PSIsContainer)} | Foreach { if ( $_.Name -eq "livebolivar.com") {remove-item $_.fullname -confirm}} 

这删除了子文件夹:

$path= @("%USERPROFILE%\desktop\websites\*\livebolivar.com")
$folders= gci -path $path -Recurse | Where-Object {$_.PsIsContainer} |Group-Object {$_.FullName.Split('_')[0] }
ForEach($folder in $folders){
$folder.Group | % { Remove-Item $_.fullname -recurse -force}} 

制作测试文件夹:

pushd %USERPROFILE%\Desktop
foreach($i in -10..-1){
$z=(Get-Date).AddDays($i).tostring("MMddyy")
ni -itemtype directory $z\livebolivar.com\New Folder > $null}
ni -itemtype file $z\livebolivar.com\New Folder\test.txt > $null}
popd 
exit 

递归目录删除目录递归删除目录和子目录用remove-item删除目录和子目录用ri

powershell powershell-5.0
  • 1 个回答
  • 375 Views
Martin Hope
somebadhat
Asked: 2019-12-17 21:57:29 +0800 CST

如何使用 cmd 或 PowerShell 脚本捕获/记录/下载多个流式音频 url?

  • 5

Windows 10 64 位。

如何使用 cmd 或 PowerShell 脚本捕获/记录/下载多个流式音频 url?

我每晚使用 cmd 批处理从 15 个服务器捕获 15 个 .mp3 音频流,持续一个小时。我经历过 wget、ffmpeg、vlc 和 curl。我的脚本产生了不可靠的结果,只有七分之一的一天所有 15 个流捕获一个小时。卷曲是最可靠的。我为每个流打开一个 curl 实例。

start "" /min %windir%\curl.exe.lnk http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_q -o "%temp%\bbc1.mp3" 

我今晚尝试了powershell,但失败了。15个powershell实例中的一半慢慢地关闭了自己,​​另一半没有捕获一个小时。

start "" /min "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.lnk" -Command "(new-object net.webclient).DownloadFile('http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_q', '%temp%\bbc1.mp3')"

我认为在一个 powershell 实例中捕获 15 个流可能会更好,但第二个流永远不会启动,因为第一个流永远不会结束。

$Urls = @()
$Urls += "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_q"  
$Urls += "http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio3_mf_q"

$OutPath = "$env:temp\"

ForEach ( $item in $Urls) {
$file = $OutPath +  ($item).split('/')[-1] + ".mp3"
(New-Object System.Net.WebClient).DownloadFile($item, $file)
}

四个小时的 bing 和 google 没有答案。

如何从命令行捕获/录制/下载流式音频?

我没有被困在 powershell 或 curl 上。唯一的要求是它在 Windows 10 64 位上运行,它可靠地捕获所有 15 个流,并且它可以在没有用户交互的情况下运行。

audio cmd.exe
  • 2 个回答
  • 1756 Views
Martin Hope
somebadhat
Asked: 2019-11-24 04:35:04 +0800 CST

Windows 10 正则表达式。词中没有出现的每一个 ci:关联电容器单元间距

  • 8

Windows 10 64 位。Powershell 5. Notepad++ v.7 32 位

正则表达式:每次出现的ci不在单词中:

associate associates associations capacitor cellspacing cig cipher circle circuit circular circumstances cite citi city commercial crucial dcim decide dependencies electricity especially explicitly fencing forcing gci implicit insecticide insufficient lucida Macie Macintosh official opacity pci pci-e placing policies precision principals reducing replacing social spacing special specification specify specified specifies specifying tracing warcinfo

我需要检查/编辑ci39 个 ascii 文本文档中单词/字符串的出现。ci通过不在单词列表中查找,我可以将必须​​检查的项目减少 99% 。

我可以通过以下方式分隔单词:|、逗号、制表符、空格、单行、多行...。

我错过了我读过的谷歌页面的逻辑。

你将如何进行?

/(ci)/g发现每一次出现ci

找不到足够的:

\b(?!list|of|words|delimited|by|pipe)\b(ci)

一无所获:

^\/(?!list|of|words|delimited|by|pipe)((ci)+)$

在单词 y 中查找 x 的每个出现,在单词列表中查找 x 的每个出现。

windows-10 notepad++
  • 1 个回答
  • 145 Views
Martin Hope
somebadhat
Asked: 2019-07-09 11:42:01 +0800 CST

PowerShell 从命令行设置文件夹/目录的权限

  • 5

有没有更好/更简单的方法来从命令行设置 Windows 文件夹的权限?

我正在使用 powershell、get-acl 和 set-acl。

# Set permissions on a folder using powershell, get-acl and set-acl.
# make directory before settings permissions.  setting permissions code creates file.
# if the user has no permissions on the folder run this script in a window with admin privileges.
# windows 10
# powershell 5
# change zpath and zuser
$zpath="F:\Users\Default\Documents\_NOTEPAD++ AUTOBACKUP"
$zuser="_9doug"
If(!(test-path $zpath)){New-Item -ItemType directory -Path $zpath | Out-Null}
$Acl = Get-Acl $zpath
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule($zuser, "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl.SetAccessRule($Ar)
Set-Acl $zpath $Acl
exit 
icacls powershell-5.0
  • 1 个回答
  • 11076 Views
Martin Hope
somebadhat
Asked: 2019-03-31 07:59:24 +0800 CST

Powershell 和正则表达式:Notepad++“保存时备份”文件列表。编辑名称,按上次写入时间排序

  • 4
# Microsoft Windows [Version 10.0.17134.648] 
# powershell 5.1.17134.48
# Calculate time to complete task using Notepad++ "backup on save" feature.  Create a copy and paste table of files sorted by LastWriteTime.    
# Can be used as a shortcut: powershell -noexit $time = (Get-Date).AddDays(-1); gci * -exclude _*, 1* | where {$_.LastWriteTime -gt $time}| sort -property LastWriteTime -descending | Format-Table LastWriteTime, length, @{n='foo';e={$_.Name -replace '(?<=^.*\.html).*$' -replace '(?<=^.*\.jpg).*$'}} -HideTableHeaders
# start it in %userprofile%\Documents\NOTEPAD++ AUTOBACKUP
Set-Location -Path "$env:userprofile\Documents\NOTEPAD++ AUTOBACKUP"
# how old a file? Today? 4 days old?
$time = (Get-Date).AddDays(-1)
# $time = (Get-Date).AddDays(-4)
# do you want to exclude files with -exclude? Do you want to include with -include?
gci * -exclude _*, 1* | where {$_.LastWriteTime -gt $time}| sort -property LastWriteTime -descending | Format-Table LastWriteTime, length, @{n='foo';e={$_.Name -replace '(?<=^.*\.html).*$' -replace '(?<=^.*\.jpg).*$'}} -HideTableHeaders
gci * -exclude _*, 1* | where {$_.LastWriteTime -gt $time} | sort -property LastWriteTime -descending | Format-Table LastWriteTime, length, Name -HideTableHeaders
# gci * | where {$_.LastWriteTime -gt $time} | sort -property LastWriteTime -descending | Format-Table LastWriteTime, length, @{n='foo';e={$_.Name -replace '(?<=^.*\.html).*$' -replace '(?<=^.*\.jpg).*$'}} -HideTableHeaders
# gci * -include [0-9][0-9][0-9]*, avail* | where {$_.LastWriteTime -gt $time} | sort -property LastWriteTime -descending | Format-Table LastWriteTime, length, @{n='foo';e={$_.Name -replace '(?<=^.*\.html).*$' -replace '(?<=^.*\.jpg).*$'}} -HideTableHeaders

输出:

5/4/2019 10  :  47  :  27 AM  114036 springhill_falls2bd750_885.jpg
5/4/2019 10  :  45  :  25 AM 1301974 springhill_falls2bd750_885.psp
5/4/2019 10  :  37  :  08 AM   19268 springhill_falls2bd13.html
5/4/2019 10  :  37  :  08 AM   94007 available13.html
5/4/2019 10  :  37  :  08 AM   36729 index.html
5/4/2019 10  :  32  :  16 AM   62801 aj.php

和:

5/4/2019 10  :  47  :  27 AM  114036 springhill_falls2bd750_885.jpg.2019-05-04_104748.bak
5/4/2019 10  :  45  :  25 AM 1301974 springhill_falls2bd750_885.psp.2019-05-04_105221.bak
5/4/2019 10  :  37  :  08 AM   19268 springhill_falls2bd13.html.2019-05-04_105856.bak
5/4/2019 10  :  37  :  08 AM   94007 available13.html.2019-05-04_105657.bak
5/4/2019 10  :  37  :  08 AM   36729 index.html.2019-05-04_105657.bak
5/4/2019 10  :  32  :  16 AM   62801 aj.php.2019-05-04_103229.bak

Microsoft Windows [版本 10.0.17134.648]
powershell 5.1.17134.48

使用 Notepad++ / NPP / Notepad Plus“保存时备份”功能计算完成任务的时间。

创建按 LastWriteTime 排序的文件的复制和粘贴表。

可以用作快捷方式:

powershell -noexit $time = (Get-Date).AddDays(-1); gci * -exclude _*, 1* |
    where {$_.LastWriteTime -gt $time} | sort -property LastWriteTime -descending |
    Format-Table LastWriteTime, length, @{n='foo';e={$_.Name
    -replace '(?<=^.*\.html).*$' -replace '(?<=^.*\.jpg).*$'}} -HideTableHeaders

在 NPP 自动备份所在的目录中启动它。我的文件备份到%userprofile%\Documents\NOTEPAD++ AUTOBACKUP

此脚本创建一个格式化的表格输出,其中包含编辑后的文件名、大小、日期和每次写入文件的时间。可以很容易地修改要搜索的文件、如何编辑文件名以及要搜索文件的天数。这是跟踪文件处理时间、任务完成时间、项目时间的便捷方式。

有关正则表达式的信息,请参阅下面的 LotPings 答案。

windows-10 powershell text-editing
  • 2 个回答
  • 737 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve