Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Create folder from Volume name  (Read 3702 times)

0 Members and 1 Guest are viewing this topic.

neilw

    Topic Starter


    Starter

    Create folder from Volume name
    « on: February 03, 2009, 03:38:37 PM »
    I want to copy numerous CD's to a server. I want to place the files from each CD into a folder named after the CD Volume name.

    There are about 4 cd's that have the same volume name so I would need to be warned about over writing a folder and have the option to modify the target folder name if there is a conflict. Since there are only a few of these I can manually handle it vs. trying to program it as long as the folders don't get over written by the batch file. Ideally I want to just opo in a CD and run the batch without having to babysit it, so prompting should only be when a decision must be made. All the folders will be in one main folder on the server.

    I also want to create a database for all the files that will contain the filenames, type (extension), last write date and folder location. I will be using Access. All I need are delimited text files with the needed fields that I can import into Access.

    I used to work with DOS years ago and have made some simple batch files so that would be the easiest for me.

    TIA,
    Neil

    neilw

      Topic Starter


      Starter

      Re: Create folder from Volume name
      « Reply #1 on: February 03, 2009, 04:06:55 PM »
      I found a utility that will create the text files for the database so that part is covered.

      Dusty



        Egghead

      • I could if she would, but she won't so I don't.
      • Thanked: 75
      • Experience: Beginner
      • OS: Windows XP
      Re: Create folder from Volume name
      « Reply #2 on: February 03, 2009, 11:51:15 PM »
      Welcome to the CH forums.

      The following script might do what you want, you will have to modify the drive letter for the cdrom and source and destination paths to suit your purpose.  The script is totally untested...

      Code: [Select]
      @echo off
      cls

      for /f "tokens=1-6" %%A in ('vol c:') do (
          set vol=%%F & goto rumble
      )

      :rumble
      if exist path\%vol% (
         echo Destination folder %vol% already exists... & goto newname
         ) else (
         md path\%vol%
         copy "c:\*.*" "path\%vol%\"
      )
      cls
      exit/b

      :newname
      set /p vol=Enter new name for destination folder: 
      goto rumble

      Good luck
      One good deed is worth more than a year of good intentions.

      neilw

        Topic Starter


        Starter

        Re: Create folder from Volume name
        « Reply #3 on: February 04, 2009, 08:36:15 AM »
        I got your program to work Dusty. All it needed was a few minor tweaks, namely change the COPY command to XCOPY, take out the wildcards and add the /s parameter to XCOPY and put the quotes only around the destination path.

        Thank you!