dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Music wishlist: recursively creating empty text files using folder name

  1. #1
    Join Date
    Oct 2007
    Posts
    0

    Music wishlist: recursively creating empty text files using folder name

    Hi, I'm very new to VB and I was wondering how to do the following:

    I have a wishlist which consists of a directory of folders where each folder is named the title of the song I am looking for.
    For example:
    C:\Downloads\Wishlist\Artist - Title [Remix]
    C:\Downloads\Wishlist\Artist - Title A + Title B + Title C

    What I want to know is how to use VB to go through each folder in my wishlist and create a blank text file where the name of the text file is the name of the parent folder and if a text file already exists with its filename = parent folder name then don't do anything but still go through the process of deciding what the filename of the text file should be and have a final step to check whether to go ahead with creating the text file - any other TEXT FILE(S) should be deleted. Also note on some occasions the folder names can be very long which XP doesn't like and although I've successfully created the folder I can't copy the contents of the folder:

    C:\Downloads\Wishlist\Angel Anx & Aleksij feat. Eva Diva - Dream Constellation (Free Your Mind) [D. Angelovski + Jay Cox Remixes]
    C:\Downloads\Wishlist\Eric Prydz Presents Pryda - Agag + Aftermath [2007 Edit] + Big Boss + Chicago + Deep Cologne + Europa aka Simbora + Seadweller [2007 Edit] + Storm + Tribute To Stockholm

    For example:
    C:\Downloads\Wishlist\Artist - Title\Artist - Title.txt

    ------------------------------------------------------------

    There are also 3 special cases to consider which differ from the standard of: C:\Downloads\Wishlist\Artist - Title\Artist - Title.txt
    Please note that these cases don't always appear on their own and could appear more than once for a single folder (See uploaded Wishlist > link at the end).

    1.
    C:\Downloads\Wishlist\Style Of Eye - Fick + Grab It Now + H-Bomb

    Where text files should be created as follows:
    C:\Downloads\Wishlist\Style Of Eye - Fick + Grab It Now + H-Bomb\Style Of Eye - Fick.txt
    C:\Downloads\Wishlist\Style Of Eye - Fick + Grab It Now + H-Bomb\Style Of Eye - Grab It Now.txt
    C:\Downloads\Wishlist\Style Of Eye - Fick + Grab It Now + H-Bomb\Style Of Eye - Grab It Now.txt

    NOTE: There could be any number of songs by the same artist.

    ------------------------------------------------------------

    AND

    ------------------------------------------------------------

    2.
    C:\Downloads\Wishlist\Noir - Times Of My Life [Original + Arias + Ben Macklin Remixes]

    Where text files should be created as follows:
    C:\Downloads\Wishlist\Noir - Times Of My Life [Original + Arias + Ben Macklin Remixes]\Noir - Times Of My Life.txt
    C:\Downloads\Wishlist\Noir - Times Of My Life [Original + Arias + Ben Macklin Remixes]\Noir - Times Of My Life [Arias Remix].txt
    C:\Downloads\Wishlist\Noir - Times Of My Life [Original + Arias + Ben Macklin Remixes]\Noir - Times Of My Life [Ben Macklin Remix].txt

    NOTE: The word "Original" in the folder name doesn't appear in the text file name and the word "Remixes" in the folder name changes to "Remix" and is added to both text file names where a remixer exists.

    ------------------------------------------------------------

    AND

    ------------------------------------------------------------

    3.
    C:\Downloads\Wishlist\Steve Lawler - Sleep Walking aka Fools Paradise + Violet

    Where text files should be created as follows:
    C:\Downloads\Wishlist\Steve Lawler - Sleep Walking aka Fools Paradise + Violet\Steve Lawler - Sleep Walking.txt
    C:\Downloads\Wishlist\Steve Lawler - Sleep Walking aka Fools Paradise + Violet\Steve Lawler - Violet.txt

    NOTE: "aka Fools Paradise" doesn't appear in the text file name.

    ------------------------------------------------------------

    I know this can be done using a MS-DOS batch file but I thought it might be easier to use VB. Thanks in advance. Sorry it's so long winded!

    LINK: http://www.sendspace.com/file/sxdbt5 > Wishlist.zip

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego
    Posts
    202
    You can do all this with more power or flexibility than batch files. You will need to instantiate the Scripting.FileSystem object.

    VBScript Reference:
    http://msdn2.microsoft.com/en-us/library/3ca8tfek.aspx

    File System Object (FSO) Reference:
    http://msdn2.microsoft.com/en-us/library/bkx696eh.aspx

    Good luck,
    Michael Sanchez
    Managing Technical Editor
    Forum Moderator
    FreeVBCode.com

Similar Threads

  1. Replies: 2
    Last Post: 02-28-2002, 11:53 AM
  2. full text for files
    By yog in forum Database
    Replies: 0
    Last Post: 01-26-2002, 05:49 AM
  3. Creating DSN to text files using VB code
    By Filipo Novo Mór in forum VB Classic
    Replies: 0
    Last Post: 09-27-2001, 08:39 AM
  4. Double Text 1.0
    By George Gilbert in forum vb.announcements
    Replies: 0
    Last Post: 08-19-2001, 11:34 AM
  5. reading multiple text files
    By simon in forum XML
    Replies: 6
    Last Post: 07-27-2001, 12:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center