Link to home
Start Free TrialLog in
Avatar of Se Lai
Se Lai

asked on

Delete File or Modify Permission

All,

Someone create a file in share drive, we would like to to modify the permssion to remove it but we are not able to do anything with this single file. I tried from CMD/GRAPHIC and also tried to change the permission but no luck. Can you pleas help me? please see the attached file... Windows server 2016

REgards
Permission-Issue.JPG
Avatar of DrDave242
DrDave242
Flag of United States of America image

Are you logged into a user account that's a member of the local Administrators group on that server? If so, you should be able to take ownership of that file (in the file properties window, click the Security tab, then click Advanced - the current owner will be shown near the top). Once you're the owner, you should be able to set permissions on the file regardless of the current permission settings.
Avatar of Se Lai
Se Lai

ASKER

Yes my account has full administrators right, but still I am unable to take the ownership or change the permission.
When you try to take ownership, do you get "Access denied" or some other error?
Avatar of Se Lai

ASKER

Yes Access denied
Is the file in a folder shared or used by a cloud system like Google Drive, One Drive, Dropbox, or similar? It is possible they have it locked. If that is the case, try deleting the file on the web interface for the share system it resides in.
1. Download and extract the PSTools from Microsoft: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
2. Open a command prompt as administrator
3. Run the following command to open a command prompt with the system user:
    > <path to pstools folder>\psexec.exe -i -s -d cmd
4. In the new command prompt that is opened, run the following command to remove the folder
   > rd /S /Q <path to folder to delete>

Give that a shot. If it doesn't work then something is locking the file. You can download and run Process Explorer: https://docs.microsoft.com/en-us/sysinternals/downloads/process-explorer
Click on the binocular icon to search and enter the path of the folder. It will bring up any processes that are accessing the folder.
Avatar of Se Lai

ASKER

None of them worked for me.... its a .pdf file I cant change anything...
What errors are you getting?
Did you find anything with process explorer?
Avatar of Se Lai

ASKER

For the first option it says count find the directory and for the second it while searching for directory and file, not giving me any process>>> an empty result..
Whoops! I don't know why I thought you were trying to remove a folder.

Try the same process I specified except for step 4 run del /q <path to file>
Avatar of Se Lai

ASKER

Jeremy

See the attached file for error...
DELFILE.JPG
Ah, you need to put quotes around the path. e.g.
del /q "S:\Purchase Req Logs\Purchase Requisition Logs - blah\Facilities\FAC-18-135 blah blah blah.pdf"

Open in new window

Avatar of Se Lai

ASKER

Here is the message after adding quotes:

C:\WINDOWS\system32>del /q "S:\Purchase Req Logs\Purchase Requisition Logs - \Facilities\FAC-18-135 J. Kittelberger & Sons.pdf"
The system cannot find the path specified.
Regards
Avatar of Se Lai

ASKER

I had the same message while removing directory(Facilities)..
Is S: a local drive or mapped? Running an application as another user means you'll be getting the runas user's environment. This means any mapped drives will need to be remapped. The command should be done on the server that actually contains the file and to the literal path. Not a mapped drive or UNC path.
Se Lai. Can you navigate to the path by hand and then delete the file? Try changing directories by using the tab completion method (start typing the path and hit tab) to move one directory at a time to get to the path you want.

Spaces in names and folders is always problematic and should be avoided when possible as a best practice.
Avatar of Se Lai

ASKER

Tried on the server(local drive) received: Access is denied.


Previously i was trying to remove it from mapped drive.

Regards
access-denied.JPG
Is the file open on some other system by any chance?
I would still try the CD down the path one folder at a time. You would at least discover where access is not allowed.
Avatar of Se Lai

ASKER

None can open the file because there is no permission. We tried to set it but no luck.
I assume you're running this on the server as the system account, right?

Run this with a user that has local admin rights:
takeown /F "X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities\FAC-18-135 J. Kittelberger & Sons.pdf" /A
icacls "X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities\FAC-18-135 J. Kittelberger & Sons.pdf" /inheritance:e
del /q "X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities\FAC-18-135 J. Kittelberger & Sons.pdf"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Owen Rubin
Owen Rubin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The claim is that some part of an Adobe program (process) may still be running on the last machine to touch it.
If this is the case then it should show when searching in Process Explorer. @Se Lai, when doing the search, make sure you're doing it from the actual server and not another computer.
Jeremy, it was a grasping at straws suggestion. My friend at Adobe says he has seen a client machine that opened a pdf or photo shop file on a server, make changes, and then quit that app on the client, but some part on the client holds the file open. So yea, if you know what client touched it last, it would show up on that clients processes. But would it show on the server as well?
There is this old tool that helps with locked files. Not sure it will work in this instance, I use it on client machines:

http://www.emptyloop.com/unlocker/
Yup, it would definitely show on the server. In process explorer it would be the "system" process as that handles file shares. If it is in use, you can then take a look at the opened files and see who exactly has it open and forcefully disconnect them in the MMC. :)
Thanks. I do not run servers anymore, but I guess it would look similar to a local machine, so was not sure where that would show.
By the way, my Adobe friend said this has been an issue with some Adobe programs since 2012!  Ugh!
I also wonder if one of the folders along the path has wrong permissions, and not the file itself? Might we be chasing the wrong permissions? I suggest this because he seems to be trying to delete via a path rather than cd to the folder and delete it there.
If the file can be seen in explorer then the takeown command should allow the setting of any permissions necessary. But it very well could be further up the path.
Avatar of Se Lai

ASKER

Hello

For the takeown command i received: ERROR: Access is denied.

And for explorer please see attached file, I hope I am running it correctly...
ex.JPG
For the takeown command i received: ERROR: Access is denied.

I am more and more pointing to a directory in the path that may be set to read only.

Have you tried 'cd' walking the directory tree and looking at each folder's permissions?

And there is always the reboot off network, try deleting the file, and then reconnecting.
Avatar of Se Lai

ASKER

X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities>del /q "FAC-18-135 J. Kittelberger & Sons.pdf"
X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities\FAC-18-135 J. Kittelberger & Sons.pdf
Access is denied.



X:\Shared\Purchase Req Logs\Purchase Requisition Logs - \Facilities>del /q "FAC-18-135 J. Kittelberger & Sons.pdf" /inheritance:e
Invalid switch - "inheritance:e".
Damn.

So we may need to walk the entire path and look at the permissions on each folder down the line.

Can I see the permissions for each folder down to the folder "Facilities" please?  ( ls- al on the folder "Facilities" from the folder "Purchase Requisition Logs -", and the same for each folder in the path.)

Will you do the same for the files that will not delete too please?

I would like to eliminate as many things as possible.
Avatar of Se Lai

ASKER

Owen
I have permission on all folders but the only problem is this file, I dont have permission and i cant assign permission to it. I have full permission on Facilities folder but still cant assign to this single file...
Thank you. This is a tough issue. Doing some research. A this point, I am not even sure a reboot would make any difference.
Se Lai, who makes the server? Is it an HP?

And sorry, on mobile, but have you tried: Computer Management/Shared Folders/Open Files" to see if the file is open?
Avatar of Se Lai

ASKER

I rebooted the server which my removed all connection to this file. After a reboot I was able to removed it.
Well, I am sorry to say that is what my Adobe friend told me was the best way (as I sadly suggested it above.) I just hate that it was the answer that "solved" your problem. Still would want to know what kept the file open.

Glad you got it to work though.
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: 'Owen Rubin' (https:#a42702101)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

seth2740
Experts-Exchange Cleanup Volunteer