Home > OS >  How to bulk delete folder name in the "date of different digital" characters, will have a
How to bulk delete folder name in the "date of different digital" characters, will have a

Time:09-30

How to batch remove the certain number of string of the folder name?

For example:

Batch folder name respectively are:

30, what what what what text in # # @ (16-21 2019-8-26-01)

20 what what what what text in # # @ (16-22 2019-8-26-05)

10, what what what what text in # # @ (16-24 2019-8-26-06)

It is revised as follows:

What what, 30,

What what, 20,

10 what

As long as the name of the front, the back of the deleted,

Is to modify the folder name instead of a file name in the directory

CodePudding user response:

Put out all your directory name, don't know do you have any other directory directory name, you take yourself
Assuming that directory without other directories, files

 
For I ` in ls//* * * * * * `
Do
NEW_NAME=` echo $I | awk -f "#" '{print $1}' `
Mv $I ${NEW_NAME}
The done


` ls//* * * * * * ` is take all your directory (here is the path you don't have other directories, files, so, you go to deal with, come out)
NEW_NAME is the need to be modified into the name of the echo $I | awk -f "#" '} {print $1 '(don't know whether your directory name is # #, or your comments, print name to # for separators (-f "#") of the first field "$1")
Then mv name
  • Related