Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Delete Symbolic Link

$
0
0

Hi!

So I made some test on different servers, they all result in the same behaviors.

I created a file and a link to it.
I created a directory and a link to it. 

So in my dir I have:

linkToDir -> testDir/
linkToFile -> testFile
testDir
testFile 

 

I first call DeleteDirectory on linkToDir, it deletes testDir/, then I callDeleteFile on linkToDir, it deletes linkToDir.
I call DeleteFile on linkToFile, it deletes testFile, then I callDeleteFile on linkToFile, and I got a SftpPathNotFoundException.

I confirm that calling DeleteDirectory on linkTofile, result in an error, since there is no such directory,linkToFile is a file, and it is pointing to a file.

So I guess, if I don't know at what the link is pointing to, I first have to callDeleteDirectory, and if it doesn't work call DeleteFile, in order to delete the item at what the link is pointing to.
But as you can see, I cannot remove the link if it was pointing to a file, becauseDeleteFile (and Delete), throws a SftpPathNotFoundException.

I have tested this with FileZilla, a Delete action on linkToDir, you are proposed to remove the link or the directory pointed at. If you remove the dir, the link is still present, you can then remove it. A Delete action onlinkToFile, removes both the link and the file.
I also tried FlashFXP, it also allows me to delete everything, it doesn't follow symlink, so if I removelinkToDir, or linkToFile, I still have to delete testDir/ andtestFile myself, but I can delete them all. 


Viewing all articles
Browse latest Browse all 1729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>