473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Restrict Directory Deletion

Hi there,
My C# application opens a directory and deals with the files inside
it. But at the mean time i can delete the directory from windows.
Is there any way i can restrict the deletion of that directory when
its being used by my application.
I need to do like

1. open directory by application.
2. lock it by application.
3. deal with directory's content.
4. unlock directory
5. exit application.

Do i have to use ACL for this?

please help me
miztaken

Sep 21 '08 #1
1 2089
You can open a file stream on a file in the folder and issue a lock on it,
that would stop the folder being removed but not the files you dont have a
lock on. You could open each of the files issuing locks. It should still let
you do things as you own the handle.
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"miztaken" wrote:
Hi there,
My C# application opens a directory and deals with the files inside
it. But at the mean time i can delete the directory from windows.
Is there any way i can restrict the deletion of that directory when
its being used by my application.
I need to do like

1. open directory by application.
2. lock it by application.
3. deal with directory's content.
4. unlock directory
5. exit application.

Do i have to use ACL for this?

please help me
miztaken

Sep 22 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: pembed2003 | last post by:
Hi All, I am trying to restrict access of PHP script to a single directory only. How can I do that? I am running Apache 1.3 and PHP 4 in Linux. I think I need to use the Directory and SetHandler...
7
by: Tony | last post by:
Hi there, Is there any event you can catch that would you allow to cancel the deletion of a file or directory. The FileSystemEventHandler allows you to catch file operations after they have...
2
by: Jaydeep | last post by:
Hi, I want to restrict any user if he types url directly in the browser without logging to my site. Like for example user should not see any listing page of my web site by typing url...
10
by: mansimisha | last post by:
Hi to everybody.. I need a help need to have a program to represent directory structure(a directory can contain any number of directory or files) alos write a programme to insert one element nd...
11
by: comp.lang.php | last post by:
Once again, I thought my class method deleteZip() would do the trick, but it never deletes any .zip* file found in a directory: /** * Delete any latent ZIP files found in this album. This...
2
by: phpnoob | last post by:
I have a php script that processes a form and then posts the user input to a data file on the server in a comma delimited format. For simplicity call the file "data.csv." The script is working...
5
by: Gordon | last post by:
I'm trying to remove a directory and all its contents from within a script. I wrote a recursive function to take care of it, but when I run it I get random "Directory not empty" error messages. ...
2
by: diwakar09 | last post by:
Hi, Is there any in c/c++ through which i can mark some directory or files for deletion, But this deletion should happen only on next restart of system. I have to implement it in a application...
8
by: aki | last post by:
Hi All, I describe the problem as below. A directory( path known) , contains 0 to any number of files . The file names are with following structure : ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.