Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recursively creating blank text file using parent folder name.

Status
Not open for further replies.

u01jmg3

Technical User
Dec 16, 2005
8
GB
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: > Wishlist.zip
 
<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.

I'm right out of breath....

Suppose you break this down into parts. Do what you can, post back when you have trouble.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top