Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

Dir creation batch file


  • Please log in to reply
1 reply to this topic

#1 MarkBeepBeep

MarkBeepBeep

  •  Avatar image
  • Members
  • 82 posts
  • OFFLINE
  •  
  • Local time:10:39 PM

Posted 03 April 2021 - 09:18 PM

I got some help years ago to re-create a directory structure from one disk to use on another disk.

 

What I do is delete the files in the directories and am just left with the entire directory/folder structure,

but no actual files.

Then I add new files to the directory structure.

 

It worked well for many years.

There are two .bat files.

The first copies the dir structure (no files) to a .txt file.

Then the second .bat file uses this .txt file and creates

the actual directories on the new disk.

 

The first .bat file worked well. It created the .txt intact with all the folders.

But the second .bat file is not creating these folders on the new drive.

 

Maybe someone can help me out fixing this?

 

Here is the .bat file that is supposed to create the folders on a second drive.

 

for /f "usebackq delims=" %%A in ("e:\dirlist.txt") do md "%%A"

 

dirlist contains all the directories/folders.

Is "usebackq" a special command, or is it specific to a previous backup of mine?

What is the significance of  %%A?

 

Thanks!



BC AdBot (Login to Remove)

 


#2 MarkBeepBeep

MarkBeepBeep
  • Topic Starter

  •  Avatar image
  • Members
  • 82 posts
  • OFFLINE
  •  
  • Local time:10:39 PM

Posted 04 April 2021 - 12:02 AM

Well while I was waiting for a reply I discovered I could copy the folder

structure without a .bat file!

 

This is what I used:

 

xcopy f:\ e:\ /t /e

 

Much simpler to use.  :)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users