I am trying to rename the following directory structure
Tests Directory ├── Test1 Directory │ ├── 2 - 1. Data │ ├── 3 - 2. Data │ ├── 4 - 3. Data │ ├── 5 - 4. Data │ ├── 6 - 5. Data ├── Test2 Directory │ ├── 2 - 1. Data │ ├── 3 - 2. Data │ ├── 4 - 3. Data │ ├── 5 - 4. Data ├── Test3 Directory │ ├── 2 - 1. Data │ ├── 3 - 2. Data │ ├── 4 - 3. Data │ ├── 5 - 4. Data │ ├── 6 - 5. Data With
Tests Directory ├── Test1 Directory │ ├── 1. Data │ ├── 2. Data │ ├── 3. Data │ ├── 4. Data │ ├── 5. Data ├── Test2 Directory │ ├── 1. Data │ ├── 2. Data │ ├── 3. Data │ ├── 4. Data ├── Test3 Directory │ ├── 1. Data │ ├── 2. Data │ ├── 3. Data │ ├── 4. Data │ ├── 5. Data If I run fd -t d -x rename 's/^(\d+ -)\s(\d+.)/$1/' in Test1, Test2 & Test3 - it works.
However, I want to use the command in Test so that I do not have to run the command in each directory.
I have tried
% find . -type d -exec rename 's/^(\d+ -)\s(\d+.)/$1/' {} \; % find . -type d -exec rename 's/^(\d+ -)\s(\d+.)/$1/' {} ";" Nothing is working. What can I do?
Adding more details.
% find . -maxdepth 2 -type d -execdir echo {} \; ./. ./Test1 Directory ./2 - 1. Data ./3 - 2. Data ./4 - 3. Data ./5 - 4. Data ./6 - 5. Data ./Test2 Directory ./2 - 1. Data ./3 - 2. Data ./4 - 3. Data ./5 - 4. Data ./Test3 Directory ./2 - 1. Data ./3 - 2. Data ./4 - 3. Data ./5 - 4. Data ./6 - 5. Data PS, The directory names have spaces.
find . -type d -execdir rename 's!^\./(\d+ -)\s(\d+\.)!$2!' {} +