Hello there! Recently, I tried deleting some symbolic links in VB, but it turns out their targets were wiped out as well. More specifically, I'm looking for a way to purge an entire directory from all the files/symlinks it contains, without doing anything to the targets.

Any help is much appreciated. :)

Recommended Answers

All 11 Replies

Huh?

All your symbolic links is saved in a file. You can retreive these links by running fsutil. This is on XP and I am sure on Vista. Not sure about 7 or other OS's.

I think when an error is raised, it means that the file is no longer in the path as specified in fsutil. That means that the actual file has either been deleted or moved, thus the error.

Try the following links for more readup on this subject. -

http://en.wikipedia.org/wiki/Symbolic_link

http://www.google.co.za/search?sourceid=navclient&aq=2&oq=symbolic+links+in&ie=UTF-8&rlz=1T4WZPA_en___ZA340&q=symbolic+links+in+windows+xp

I am not sure if this is what you were looking for, but with the kinks I am sure you will find your answer...

I'm sorry, I didn't make myself clear. I don't recieve an error message.
I would like to empty the folder directory1 completely. directory1 contains link1, link2 and link3, which are symbolic links to target1, target2 and target3.
Is there any way to delete link1, link2 and link3 without affecting the targets using VB6?
Last time, I deleted directory1 and re-created it, but it turns out that that affected the targets (by wiping them out as well)

Thanks in advance!

Are you talking about shortcuts? *.lnk files?

Nope. If it was just .lnk-files the targets wouldn't be affected. Symlinks are a more elegant solution, which makes target1's files actually appear in directory1\link1; whereas shortcuts just redirects the user to target1.
http://en.wikipedia.org/wiki/Symbolic_link

Okay, I see now... Knew it as a junction point but after reading about it so long ago quickly forgot about it as at the time I never saw a good use for it, so I guess I have relearned something and learned something new today! Yeah! I'm done! :)

Okay, from here I'll step out of the way...

Good Luck

NickBomb,

I have unfortunately not worked with syslinks before. I feel like vb5 and run away as well.

Before I go however, I am thinking in the line of the following -

Copy directory file targets,
delete the syslink file,
re-create syslink file with the dir. files.

I don't know if this makes any sense, but I hope you find your answer soon. Please post any results you might have found. This is something I am going to start and play with and see what results I can return. I am sure there are other users as well that might want to know more.

Good luck bud.

I understand, but that seems to be quite a hassle. I'll look for another solution, and report back here if I find a working solution. :)
Btw - this thread is #1 when you search for "vb delete symbolic link" on google. I'm famous! :p

Cool, we'll call you DUDE BOMB from now on....:cool:

IT would help if you would identify on which OS you are trying to delete these 'symlinks.'

Different operating systems on windows have different support for linking files.

And how do you know these are symbolic links?

How are they listed?

I'm using Win7, and I know that they are symbolic links since I created them. Anyway, I have found a working solution:

Shell("cmd /c rmdir " & path)

where "path" is the path to the directory which contains the symlinks.
This works flawlessly. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.