Ok, the title sounds a little more simple than it seems. What I am trying to do is create a batch script where given a certain directory, say "z:\" creates a directory listing of certain file types (*.pst). From there, the listing then would make the folder structure from the file list in a different mapped out location, say "m:\" with a folder created for the .pst name as well. Sorry if this sounds confusing; I am relatively new to batch commands and scripting.
Foxidrive helped me earlier and put together this:
dir /s /a:-d /b /o:n "Z:\*.pst" > Filelisting.tmp
for /f "delims=" %%d in (Filelisting.tmp) do md "M:\"%%~na" 2>nul
del Filelisting.tmp
How would I go about adding to this to create a folder the *.pst within the listing?
Thanks in advance!
Filelisting to Directory Creation P2
Moderator: DosItHelp
Re: Filelisting to Directory Creation P2
sorry but what do you mean with
the code you provided create directories when it copies the files.
with a folder created for the .pst name as well
the code you provided create directories when it copies the files.
Re: Filelisting to Directory Creation P2
abc0502 wrote:sorry but what do you mean withwith a folder created for the .pst name as well
the code you provided create directories when it copies the files.
Currently the created directory only creates the folder structure up to the *.pst filename, and doesn't create a folder for the filename which I do want
Currently c:\testcase\joeblow\testing\help.pst is creating the folder structure c:\testcase\joeblow\testing
However, I would like it to create the folder structure c:\testcase\joeblow\testing\help where the filename is actually a folder.
Re: Filelisting to Directory Creation P2
The code you posted above doesn't do what you said it does.
This might do what you want.
This might do what you want.
Code: Select all
@echo off
dir /s /a:-d /b /o:n "Z:\*.pst" > Filelisting.tmp
for /f "delims=" %%a in (Filelisting.tmp) do md "M:\%%~pna" 2>nul
del Filelisting.tmp
Re: Filelisting to Directory Creation P2
foxidrive wrote:The code you posted above doesn't do what you said it does.
This might do what you want.Code: Select all
@echo off
dir /s /a:-d /b /o:n "Z:\*.pst" > Filelisting.tmp
for /f "delims=" %%a in (Filelisting.tmp) do md "M:\%%~pna" 2>nul
del Filelisting.tmp
Beautiful!! Thank you so much! works like a charm