loop through directory names using a batch file?

前端 未结 1 1310
失恋的感觉
失恋的感觉 2021-01-04 00:04

Assume I have this structure:

d:/
  -- /alpha/
  -- /beta/
  -- /gamma/
  -- /delta/

I\'m trying to execute a batch file that goes through

1条回答
  •  醉梦人生
    2021-01-04 00:27

    This is all you should need:

    for /D %i in (*) do rename "%i" "%i1"
    

    The /D performs the command against the directory names, as per the help, which can be obtained using the command for /?

    If Command Extensions are enabled, the following additional forms of the FOR command are supported:

    FOR /D %variable IN (set) DO command [command-parameters]

    If set contains wildcards, then specifies to match against directory
    names instead of file names.
    

    0 讨论(0)
提交回复
热议问题