-1

How can I remove the special character using DOS Command on folder and subfolders?

Folders:

C:\FILE\FOLDER#1\PICTURE#100

C:\FILE\FOLDER#2\PICTURE#200

C:\FILE\FOLDER#3\PICTURE#300

C:\FILE\FOLDER#4\PICTURE#400

C:\FILE\FOLDER#5\PICTURE#500

OUTPUT:

C:\FILE\FOLDER1\PICTURE100

C:\FILE\FOLDER2\PICTURE200

C:\FILE\FOLDER3\PICTURE300

C:\FILE\FOLDER4\PICTURE400

C:\FILE\FOLDER5\PICTURE500

Thanks

4

2 回答 2

1

首先在一些示例文件夹上尝试此操作。它将重命名两级文件夹。

@echo off
setlocal enabledelayedexpansion
pushd "c:\file"
for /d %%z in (*) do (
  pushd "%%z"
     for /d %%a in (*) do (
         set "folder=%%a"
         ren "%%a" "!folder:#=!"
     )
  popd
)    
for /d %%a in (*) do (
     set "folder=%%a"
     ren "%%a" "!folder:#=!"
)
popd
于 2013-10-21T11:26:06.957 回答
0

使用重命名器

$ renamer --find "#" **

递归删除所有文件和文件夹中的“#”

于 2013-10-21T12:52:03.477 回答