PC Review


Reply
Thread Tools Rate Thread

Create a directory in multiple different directories

 
 
Charles Theodore
Guest
Posts: n/a
 
      25th Aug 2004
Hi everyone,

Running Windows XP pro and looking for a way to make my batch optimized.

--------------------------actual code----------------------------------
@echo off
set pathx=\\filesrv1\MSI\Graphic
for /d %%a in (%pathx%\*.*) do md "%%a\INPUT"
set pathx=\\filesrv1\MSI\Oracle
for /d %%a in (%pathx%\*.*) do md "%%a\INPUT"
set pathx=\\filesrv1\MSI\Tools
for /d %%a in (%pathx%\*.*) do md "%%a\INPUT"
set pathx=

--------------------------desired code----------------------------------
A program that can parse all directories to create an INPUT directory.
Don't want to set every time a static pathx variable for each different directories.

Example:

\\filesrv1\MSI\Graphic\Photoshop\INPUT
\\filesrv1\MSI\Oracle\Client\INPUT
\\filesrv1\MSI\Tools\AdAware\INPUT
.... and so on on many directories.

Thank you very much!

Charles
 
Reply With Quote
 
 
 
 
Matthias Tacke
Guest
Posts: n/a
 
      25th Aug 2004
Charles Theodore wrote:

>Hi everyone,
>
>Running Windows XP pro and looking for a way to make my batch optimized.
>
>--------------------------actual code----------------------------------
>@echo off
>set pathx=\\filesrv1\MSI\Graphic

<snip>

This doesn't sound like a repititous task, so why not create a dir
listing with folders only and edit it?

Your description remains unclear, do you want only the "leaves" in your
tree to contain that "input" folder ?

This is not tested.
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal
set pathx=\\filesrv1\MSI
for /f "delims=" %%A in ('dir /B/S/AD %pathx%') do call :sub "%%A"
goto :eof
:sub
:: check if this is an INPUT folder
if /I "%~nx1" EQU "INPUT" goto :eof
:: check if already present
if exist "%~1\INPUT" goto :eof
:: check for leaves
for /F "delims=" %%B in ('dir /B/S/AD %1') do goto :eof
md "%~1\INPUT"
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

HTH
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
Reply With Quote
 
Charles Theodore
Guest
Posts: n/a
 
      26th Aug 2004
"Matthias Tacke" <(E-Mail Removed)> wrote in message news:<cgig78$6rg$02$(E-Mail Removed)>...
> Charles Theodore wrote:
>
> >Hi everyone,
> >
> >Running Windows XP pro and looking for a way to make my batch optimized.
> >
> >--------------------------actual code----------------------------------
> >@echo off
> >set pathx=\\filesrv1\MSI\Graphic

> <snip>
>
> This doesn't sound like a repititous task, so why not create a dir
> listing with folders only and edit it?
>
> Your description remains unclear, do you want only the "leaves" in your
> tree to contain that "input" folder ?
>
> This is not tested.
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> @echo off
> setlocal
> set pathx=\\filesrv1\MSI
> for /f "delims=" %%A in ('dir /B/S/AD %pathx%') do call :sub "%%A"
> goto :eof
> :sub
> :: check if this is an INPUT folder
> if /I "%~nx1" EQU "INPUT" goto :eof
> :: check if already present
> if exist "%~1\INPUT" goto :eof
> :: check for leaves
> for /F "delims=" %%B in ('dir /B/S/AD %1') do goto :eof
> md "%~1\INPUT"
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
> HTH


To your question1: How do you see that? I'm not sure to exactly
understand
your proposition :-(

To your question2: Yes, that's correct!

When i run your script, it works great to create the INPUT directory
when the directory is already empty or contain a filename (for
example, the Photoshop dir.). When the dir have already a
sub-directory, it doesn't work.

Let me show exactly the problem with an example:
\\filesrv1\MSI\Graphic\Photoshop\(if that dir is empty, creation of
INPUT work)
\\filesrv1\MSI\Graphic\Photoshop\(if that dir have a filename,
creation of INPUT work)
\\filesrv1\MSI\Graphic\Photoshop\(if that dir have a sub-directory,
it doesn't work to create the INPUT directory)

Thank you, for help !!!

Charles
 
Reply With Quote
 
Charles Theodore
Guest
Posts: n/a
 
      26th Aug 2004
"Matthias Tacke" <(E-Mail Removed)> wrote in message news:<cgig78$6rg$02$(E-Mail Removed)>...
> Charles Theodore wrote:
>
> >Hi everyone,
> >
> >Running Windows XP pro and looking for a way to make my batch optimized.
> >
> >--------------------------actual code----------------------------------
> >@echo off
> >set pathx=\\filesrv1\MSI\Graphic

> <snip>
>
> This doesn't sound like a repititous task, so why not create a dir
> listing with folders only and edit it?
>
> Your description remains unclear, do you want only the "leaves" in your
> tree to contain that "input" folder ?
>
> This is not tested.
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> @echo off
> setlocal
> set pathx=\\filesrv1\MSI
> for /f "delims=" %%A in ('dir /B/S/AD %pathx%') do call :sub "%%A"
> goto :eof
> :sub
> :: check if this is an INPUT folder
> if /I "%~nx1" EQU "INPUT" goto :eof
> :: check if already present
> if exist "%~1\INPUT" goto :eof
> :: check for leaves
> for /F "delims=" %%B in ('dir /B/S/AD %1') do goto :eof
> md "%~1\INPUT"
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
> HTH


A mistake...

Please, ignore my previous reply, the script were "word wrapped" with
notepad... I will using textpad for my future needs!

Mattias, just one tricky thing i'm wondering how to resolve is how to
make the script to create the INPUT directory just beside Photoshop,
Client and AdAware directories, not in next sub-direcories, when
available.

Example:
\\filesrv1\MSI\Graphic\Photoshop (INPUT at the same level of Photoshop
and avoid to create in sub-dir.)
\\filesrv1\MSI\Oracle\Client (INPUT at the same level of Client and
avoid to create in sub-dir.)
\\filesrv1\MSI\Tools\AdAware (INPUT at the same level of AdAware and
avoid to create in sub-dir.)

----------------------------------- your script i have run ----------
@echo off
setlocal
set pathx=D:\filesrv1\msi
for /f "delims=" %%A in ('dir /B/S/AD %pathx%') do call :sub "%%A"
goto :eof
:sub
md "%~1\INPUT"

Thank you and sorry again for confusion on previous post...

Charles
 
Reply With Quote
 
Charles Theodore
Guest
Posts: n/a
 
      26th Aug 2004
> A mistake...
>
> Please, ignore my previous reply, the script were "word wrapped" with
> notepad... I will using textpad for my future needs!
>
> Mattias, just one tricky thing i'm wondering how to resolve is how to
> make the script to create the INPUT directory just beside Photoshop,
> Client and AdAware directories, not in next sub-direcories, when
> available.
>
> Example:
> \\filesrv1\MSI\Graphic\Photoshop (INPUT at the same level of Photoshop
> and avoid to create in sub-dir.)
> \\filesrv1\MSI\Oracle\Client (INPUT at the same level of Client and
> avoid to create in sub-dir.)
> \\filesrv1\MSI\Tools\AdAware (INPUT at the same level of AdAware and
> avoid to create in sub-dir.)
>
> ----------------------------------- your script i have run ----------
> @echo off
> setlocal
> set pathx=D:\filesrv1\msi
> for /f "delims=" %%A in ('dir /B/S/AD %pathx%') do call :sub "%%A"
> goto :eof
> :sub
> md "%~1\INPUT"
>
> Thank you and sorry again for confusion on previous post...
>
> Charles



Hi have found a way to create the 'INPUT' directly exactly at the
desired place in directories. Need help to validate my script. The
principle is to locate a file with the extension .zap and when the
filename.zap is localized, make the 'INPUT' directory in that dir.
Basically, at the 4th level of dirs as illustrated below.

\\filesrv1\MSI\Graphic\Photoshop (a .zap file is here and 'INPUT must
be mkdir)
\\filesrv1\MSI\Oracle\Client (a .zap file is here and 'INPUT must be
mkdir)
\\filesrv1\MSI\Tools\AdAware (a .zap file is here and 'INPUT must be
mkdir)

Script who didn't work:
-----------------------
@echo off
setlocal
set pathx=\\\filesrv1\MSI
for /f "delims=" %%A in ('dir/B/S %pathx%\*.zap') do call :sub "%%A"
:sub
for /f "tokens=1-4 delims=\" %%B in (%~1) do (
set %%C=%~1:%%B
)
echo md "%~1\input"

Thank in advance...
 
Reply With Quote
 
Matthias Tacke
Guest
Posts: n/a
 
      26th Aug 2004
Charles Theodore wrote:
<snip>

@echo off
setlocal
set pathx=\\filesrv1\MSI
for /f "delims=" %%A in ('dir/B/S/A-D "%pathx%\*.zap"'
) do if not exist "%%~dpAINPUT" md "%%~dpAINPUT"

HTH
--
Greetings
Matthias________________________________________
For help on nt commands enter in a cmd window:
W2K>HH windows.chm::ntcmds.htm XP>HH ntcmds.chm
 
Reply With Quote
 
Charles Theodore
Guest
Posts: n/a
 
      27th Aug 2004
"Matthias Tacke" <(E-Mail Removed)> wrote in message news:<cglfm9$11j$05$(E-Mail Removed)>...
> Charles Theodore wrote:
> <snip>
>
> @echo off
> setlocal
> set pathx=\\filesrv1\MSI
> for /f "delims=" %%A in ('dir/B/S/A-D "%pathx%\*.zap"'
> ) do if not exist "%%~dpAINPUT" md "%%~dpAINPUT"
>
> HTH


100% :-)
Thank you so much.

Charles.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i create a directory than sub directories =?Utf-8?B?c3BvcnRraXdp?= Microsoft Access 1 1st May 2006 04:25 AM
Total Newbie : How to create virtual directory/sub-directories?? aepearson@gmail.com Microsoft C# .NET 1 29th Oct 2005 11:56 AM
Multiple bin-directories with virtual directories? =?Utf-8?B?TGFzc2UgTmlsc3Nvbg==?= Microsoft ASP .NET 0 9th Nov 2004 05:49 PM
create a generic import path for multiple desktop directories =?Utf-8?B?RGFuaWVs?= Microsoft Access External Data 0 12th Oct 2004 04:25 AM
XP: How to dump files from multiple directories into one directory annoyed one Windows XP General 2 29th Nov 2003 03:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:44 AM.