Bash 脚本使用 rar 提取分割存档文件
这就是我想要做的:
我在文件夹名称 Archives 上有数千个分割的 rar 存档。 文件名 0001.part1.rar 0002.part2.rar 0003.part3.rar 等等
- 读取 0001.part1.rar
- 根据上面文件的前缀创建一个目录,例如 0001
- 将所有具有相同前缀的文件移动到创建的目录上多于。
- 提取该目录中的文件
- 删除该目录中的所有 rar 文件
- 根据文本文件中的名称列表重命名提取的文件。
- Rar 具有不同参数的重命名文件。
- 将重命名的文件(来自步骤 6)移动到名为 Done 的新目录。
- 继续处理文件 0002.part1.rar,然后执行步骤 2-8 等等。
另外我如何将它与 cron 合并??? 这应该只运行一次...
在提取第一组 rar 文件后,更改为:
file.001
file.002
file.003
等我也需要提取。
对第 6 步的说明:
提取第二组 rar 后(file.001、file.002 等) 我想根据文本文件中的名称列表重命名它。
例如,文本文件中的文件列表:
0001 - GB Funds.DAT
0002 - US Bonds.DAT
0003 - SG Securities.DAT
0004 - LU Credits.DAT
第 7 步的说明:
After renaming the file I want to move it on a new folder called "Done"
第 9 步的说明:
Go back to the main folder with all the other archives
and continue extracting the next set of archives and
do the same steps from 1 to 8.
Here's what I want to do:
I have thousand of split rar archives on folder name Archives.
Name of the files 0001.part1.rar 0002.part2.rar 0003.part3.rar etc.
- read 0001.part1.rar
- create a directory based on prefix of the file above e.g. 0001
- move all files with the same prefix on the directory created above.
- Extract the files within that directory
- delete all rar files in that directory
- Rename the extracted file based on a list of names from a text file.
- Rar the renamed file with different arguments.
- Move the renamed file (from step 6) to a new directory called Done.
- Proceed to file 0002.part1.rar then do steps 2-8 and so forth.
Additional how would I incorporate it with cron???
This should be run once only...
After extracting the first set of rar's files change to:
file.001
file.002
file.003
etc. which I need to extract too.
Clarification on Step 6:
After extracting the second set of rar's (file.001 , file.002 etc.)
I want to rename it based on a list of names from a text file.
e.g. List of files from a text file:
0001 - GB Funds.DAT
0002 - US Bonds.DAT
0003 - SG Securities.DAT
0004 - LU Credits.DAT
Clarification on Step 7:
After renaming the file I want to move it on a new folder called "Done"
Clarification on Step 9:
Go back to the main folder with all the other archives
and continue extracting the next set of archives and
do the same steps from 1 to 8.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写一个 shell 脚本,其中包括如下内容:
运行它然后通过:
您必须澄清 6./8./9。
我不知道为什么你想通过 cron 运行它,因为你只想运行它一次。 at 专为运行一次性作业或在屏幕会话中运行而设计。
我建议您在开始整个工作之前,对您收集的 1-3 个文件以及最终得到的脚本进行一些测试。
You can write a shell script including something like this:
Run it then via:
You have to clarify 6./8./9.
I don't know why do you want to run it via cron, since you only want to run it once. at is designed for running one-time jobs, or run it in a screen session.
I suggest that you do a few tests with 1-3 files from your collection and the script you end up with, before starting the whole job.