Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of file backup with shell script

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to use shell script to solve the problem of file backup, many people may not know much about it. In order to make you understand better, the editor summarizes the following content for you. I hope you can get something according to this article.

The documents on the computer already have more than 50 gigabytes, in which there are some things, as well as a lot of photos and videos, and so on. These photos really take up too much space, need to be scaled down and stored, backup, do not need so high definition, the previous 50% will be fine. The requirements are simple:

Compress the JPG file

Other files have updated copies, but before there is no updated copy, I wrote a script in shell, which I think is too long. Recently, I have also been learning shell scripts, which can be solved with pipes:

DstDir=/cygdrive/g/test/srcDir=/cygdrive/h/doccd $srcDirfind | sed-r "s: ^ (. * (jpg | JPG)) $: cp-v-- parents" 1 "" $dstDir "& & convert-resize 50% x50%" $dstDir1 "" $dstDir1 ": G" | sed-r "s: ^ (. *) $: cp-vu-parents" 1 "$dstDir": G "| sh-verbose

The principle of the script is simple, replace it with sed and OK it.

After reading the above, do you have any further understanding of how to use shell scripts to solve file backup problems? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report