Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 296 Vote(s) - 3.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loop through directory names using a batch file?

#1
Assume I have this structure:

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


I'm trying to execute a batch file that goes through those folders (but not through sub-folders within them).

How do I get this result using a FOR LOOP (assuming I don't know the name and quantity of the folders):

ren alpha alpha1
ren beta beta1
ren gamma gamma1
ren delta delta1
Reply

#2
This is all you should need -- directly at the command prompt:

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

or in a batch file (note the doubled `%`):

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.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through