Simple Linux Convert Directory and File Name Script

xiaoxiao2021-03-06  71

When the original version of the script is looking for, only very simple, if you have multiple uppercase, you need to perform multiple scripts, I have modified the following, changed to two scripts, one to check the file, one is used Change the file, but how many uppercase directories, all get it once, but it is a low efficiency, it is enough to use it, if the speed should be compiled, you should use the shell to be simple, don't know that bit DX has a better way.

Call method if

Shell> uptolow.sh directory (can be absolute, it can be relative)

The script file is as follows

Uptolow.sh

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#! / bin / sh

If Test $ #! = 1Then Echo "User: $ 0 DIRECTORY" EXIT -1FILOG = "/ TMP / UPTOLOW.LOG" DIR = $ 1LOWDIR = `Echo $ DIR | TR" [AZ] "" [AZ] "` IF [ $ Dir! = $ Lowdir] Then MV $ DIR $ lowDirfi

FindtoExec () {Find $ 1 -EXEC Uptolow2.sh {} /;> & $ log}

Echo `Date % Y% M% D-% h% M`" start "

While:; Do FindtoExec $ lowDir if [-s $ log] Then Echo `Date % Y% M% D-% H% M`" Recursion next .. "Else Break Fidone

Echo `Date % Y% M% D-% h% M`" finished! "

Uptolow2.sh

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

#! / bin / shnew = `Echo $ 1 | TR" [a-z] "" [a-z] "` IF ["$ 1"! = "$ new"] The MV "$ 1" "$ new" FI

转载请注明原文地址:https://www.9cbs.com/read-88850.html

New Post(0)