У меня есть файлы, которые нужно рекурсивно переименовывать. Поэтому я выполняю команду find shop-bill -depth -type f -exec rename -v "s/shop/shop-bill/" {} +
, но она выдала мне следующую ошибку. Я был озадачен ошибкой No such file or directory
и могу подтвердить, что файлы существуют.
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ find shop-bill -depth -type f -exec rename -v "s/shop/shop-bill/" {} +
Can't rename shop-bill/dto/shop.dto.ts shop-bill-bill/dto/shop.dto.ts: No such file or directory
Can't rename shop-bill/shop.controller.ts shop-bill-bill/shop.controller.ts: No such file or directory
Can't rename shop-bill/shop.entity.ts shop-bill-bill/shop.entity.ts: No such file or directory
Can't rename shop-bill/shop.module.ts shop-bill-bill/shop.module.ts: No such file or directory
Can't rename shop-bill/shop.providers.ts shop-bill-bill/shop.providers.ts: No such file or directory
Can't rename shop-bill/shop.service.ts shop-bill-bill/shop.service.ts: No such file or directory
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ ll shop-bill/dto/shop.dto.ts
-rwxrwxrwx 1 liudonghua liudonghua 879 May 29 17:17 shop-bill/dto/shop.dto.ts*
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ tree shop-bill
shop-bill
├── dto
│ └── shop.dto.ts
├── shop.controller.ts
├── shop.entity.ts
├── shop.module.ts
├── shop.providers.ts
└── shop.service.ts
1 directory, 6 files
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$
Странно то, что я могу успешно выполнить подобную команду следующим образом.
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ tree operator-bill
operator-bill
├── dto
│ └── shop.dto.ts
├── shop.controller.ts
├── shop.entity.ts
├── shop.module.ts
├── shop.providers.ts
└── shop.service.ts
1 directory, 6 files
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ find operator-bill -depth -type f -exec rename -v "s/shop/operator-bill/" {} +
operator-bill/dto/shop.dto.ts renamed as operator-bill/dto/operator-bill.dto.ts
operator-bill/shop.controller.ts renamed as operator-bill/operator-bill.controller.ts
operator-bill/shop.entity.ts renamed as operator-bill/operator-bill.entity.ts
operator-bill/shop.module.ts renamed as operator-bill/operator-bill.module.ts
operator-bill/shop.providers.ts renamed as operator-bill/operator-bill.providers.ts
operator-bill/shop.service.ts renamed as operator-bill/operator-bill.service.ts
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ rename -v
Usage:
rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr
[ files ]
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$ rename -V
/usr/bin/rename using File::Rename version 0.20
liudonghua@desktop-ldh:/mnt/d/code/node/nestjs-sequelize-typescript/src$