bash - MV 命令行不适用于某些文件(OSX)
问题描述
我下载了一堆 youtube 视频和成绩单,并尝试使用文件标题中包含的 11 个字符的 youtube ID 重命名它们。我创建了一个文本文件,其中每一行都有旧标题、新标题并用字符“ >
”分隔
我正在使用以下命令:
parallel -j 4 --colsep '>' mv "{1}" folder/{2} :::: rename.txt
这仅适用于 90% 的文件。10% 的文件因错误而遗留。我在下面附上了一些不起作用的文件名。我怀疑有些角色对 mot mv 友好,但我被卡住了。
'Design at Large - Scaling the Studio and the Lab to the Globe' _ Scott Klemmer _ TEDxUCSD-HcMsp0wVH5Q.en.vtt
'Do yourself a favour - DONATE BLOOD' _ Meenakshi Lekhi _ TEDxDITE _ Mrs. Meenakshi Lekhi _ TEDxDITE-Sq3x7HYM3UQ.en.vtt
'I am cool with myself' - Serah. G. at TEDxInhaU-SUZ5hCqws6U.en.vtt
'Play Dead' (Björk), _ Corisco & Costellas Madera de mar _ TEDxCadizUniversity-OpbzqHN7FOU.en.vtt
'Species on the Move' _ Chad Jones _ TEDxConnecticutCollege-sqTZ5MXxm4c.en.vtt
'The Art of Being Wrong' _ Kim Schlesinger _ TEDxWartburgCollege-Kzv-lMv4qRY.en.vtt
'There's a better way to do it. Find it' _ John Keegan _ TEDxNJIT-Vrw5brX1Wfo.en.vtt
(Please), Don’t let us go extinct _ Samantha Matheijsen _ TEDxAvansUniversity-QAPId_JNcjw.en.vtt
(Pre)Human 3.0 _ Luc Deleuze _ TEDxUNamur-E7N5__flfkY.en.vtt
12x16 - The Messy Process of Unlearning _ Dominic Inouye _ TEDxUWMilwaukee-Ql7y19kBojY.en.vtt
2017's Mind-Blowing Drone Innovations _ Donna Chiu _ TEDxHKUST-T8jg5YS8hZ0.en.vtt
21st Century Education - The Science of Understanding _ Tom Koch _ TEDxGettysburgCollege-TAOKCxl71g0.en.vtt
3 Most Important Ingredients For making Perfect Success Recipe _ Bhupendra Rathore _ TEDxBalajiITS-_k65z2WEUqA.en.vtt
3 counter-intuitive ways to achieve anything you want _ David LAROCHE _ TEDxKedgeBS-aad7N-qJE40.en.vtt
3 reasons why we should share our stories with the world _ Praveen Wadalkar _ TEDxKhulnaUniversity-YtEa0mirjHo.en.vtt
320 Cakes - The Existential Escapade _ Natalie Rowland _ TEDxWilliam&Mary-1oEpR3UPLz8.en.vtt
5 Ways to Run a Great Blog _ Kimberly D'Souza & Denver Britto _ TEDxBITSPilaniDubai-UogiOStY-Ps.en.vtt
63 Days of Superstition _ Tanushri Sundar _ TEDxBrownU-Lgmu84-Pxv4.en.vtt
8 + 8 + 8 - Time Management _ Gyanvatsal Swami _ TEDxMSUniversityofBaroda-MmlEQwdqlfo.en.vtt
A PATHWAY TO HEALTHY SOCIETIES _ Rameshwar Nath Kaul Bamezai _ TEDxJECRC-LoYFgaF0PXM.en.vtt
你介意帮助我吗?谢谢!
解决方案
- 始终在处理路径或文件名的命令上标记选项的结尾,
--
以防止文件名或模式通配符被解释为选项。 - 始终对包含变量的字符串使用双引号,以防止变量内容在空格上被拆分或解释特殊字符。
parallel -j 4 --colsep '>' mv -- {1} folder/{2} :::: rename.txt
推荐阅读
- javascript - 如何在 html 的叠加层中添加文本?
- android - HTTPUrlConnection 在 getOutputStream().write 上使应用程序崩溃(挂起,没有抛出异常)
- c# - MappedDiagnosticsLogicalContext 类中 Set 方法和 SetScoped 方法的区别
- apache-kafka - 如果超过特定的字节数,是否可以删除聚合(Kafka 流)?
- php - 如何在 laravel 包中给出资产路径?
- c# - 如何从表达式主体属性c#中获取表达式
- cmd - 打开正在运行命令的 cmd 窗口
- c# - 通过我的应用程序中的控制器获取所有方法
- javascript - nodejs 中的 expressValidator 是否发生了变化?
- reactjs - 使用 eventChannel 从 Firestore 获取实时数据