Windows xp: roll my own desktop tool to copy list of directory names

93 Views Asked by At

Many times I have found the need to copy directory names from one directory into another, creating a list of empty directories in the later.

I have achieved this task using the following command:

for /F "usebackq" %i IN (`dir /b C:/backups/sites/24/01/2012`) DO makdir C:\fabio_temp\test\%i

Now i would like to create a reusable and friendly tool so that i don't have to be typing this all the time on the command line.

Example of what I want in pseudo-language:

$dir = PROMPT('Type in the name of the directory containing the list of directories to clone:');
$dir_dest = PROMPT('Type in the destination directory:');

FOREACH LIST_DIRNAMES($dir) AS $dirname DO
    MKDIR CONCAT($dir_dest,$dirname)
ENDFOREACH;

Then, it would be nice to have this function appearing in the right-click context menu. It doesn't matter what language is going to be used for this. It could be vbscript, or whatever, I don't know.

1

There are 1 best solutions below

1
On

Thanks to the tutorial that @AlbertoSolano suggested, I was able to write a simple script named mkdirs_from_list.bat with the following content:

for /F "usebackq" %%i IN (`dir %1 /b`) DO mkdir %2\%%i

That does exactly what I was asking for, and, to make things easier, I'm adding the script to the path environment, so it can be invoked like this on the command line:

mkdirs_from_list C:\dir_to_list C:\dir_dest

I wanted something more friendly, like a prompt popping up, being able to browse the directories, or something alike, but I think this will suffice.