Files cannot access because they are used by another process
I am trying to delete some files in:C:\inetpub\wwwroot\my_site\Under my_site, there are many files and folders, including bin folders which has some .dll files. As soon as I run the script, I get an error message that some of the .dll files cannot be accessed because they are being used by another process, and on some dlls, I get a permission denied error.I don't know what the problem is. I am using the following script, which works perfect for any other folders, but not for the one I am trying to delete. $content = get-childitem 'C:\Backups\my_site'
$sortedContent = $content | Sort-Object LastWriteTime -Descending
write-host "This is the list of all the backups for my_site :"
$count = 1
foreach ($item in $sortedContent)
Write-Host ("{0}: {1}" -f $count, $item.Name)
$count++
# 2.Take input from user
$itemNumber = Read-Host "Please select which backup you want to restore"
$confirmation = Read-Host "Are you Sure You Want To Proceed:"
# 2.Take input from user
if ($confirmation -eq 'y') {
# 3. BACKUP script
./bacup_mysite.ps1
# 3. BACKUP
# 4. DELETE CONTENTS OF my_site
get-childitem "C:\inetpub\wwwroot\my_site\" -recurse | % {
remove-item $_.FullName -recurse -force
# 4. DELETE CONTENTS OF APP
# 5. COPY CONTENTS OF ZIP INTO APP DIRECTORY
$itemNumber = $itemNumber -1
if($sortedContent[$itemNumber].PSIsContainer -eq $true)
$src = $sortedContent[$itemNumber].FullName + "\"
$WebzipPath = $src + "my_site.zip"
$Date = Get-Date
$folder_date = $Date.ToString("yyyy-MM-dd_HHmm")
$tempPath = 'C:\_Temp\Restore\my_site_restore_' + $folder_date
if (!(Test-Path -path $tempPath))
New-Item $tempPath -type directory
./Library/unzip.ps1 $WebzipPath $tempPath
$tempPathWeb = $tempPath + "/my_site/*"
Copy-Item -Path $tempPat -Destination 'C:\inetpub\wwwroot\my_site\' -Recurse -
force
am using a script which backups the folders and than in the next block tries to delete those folder from there original location.This is the script
if ($confirmation -eq 'y') {
# 3. BACKUP script
./bakup_mysite.ps1
#If i put a Read-Host here it does stop and than ask user to press any key and than it
deletes the next block, but i want to put a wait so user does not have to press any key
and everything happens automatically, # 3. BACKUP
# 4. DELETE CONTENTS OF my_site
get-childitem "C:\inetpub\wwwroot\my_site\" -recurse | % {
remove-item $_.FullName -recurse -force
}I would like the backup to finish first and than delete the original files, because if i use the above script while backup up some files gets locked and at the same time the next block gets executed and it tries to delete the files thats why i would like to put a wait for backup to finish
Check your assumptions. How do you know that backup is the only process that might have a lock on those files?
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Similar Messages
-
Cannot delete files from TC because they are in use?
Hi all, I have converted (SmartConverter) some avi files to my ITunes, now I am trying to remove/delete the old avi files from my Time Capsule but my Imac informes me that this is not possible because the avi files are in use. The last is not the case, at least no by me, and even after a re start I am getting the same messages. even avi files that are not converted are giving me troubles. Before the system says they are in use I am getting a message saying that the files cannot be moved to the bin. I have looked on the net for an solution but without any real luck. I hope somebody can assist me with this. Thanks Prond.
Figured it out... I used the terminal application/utility and was able to get the files off of my time capsule...
-
When I sync my Iphone4 on Itunes I get a message saying that some apps (eg Find Friends) cannot update because its not compatible with my phone.
I also am not able to up/download mail even though my Provider is adamant the setting are correct...
IOS 7.1.2
would appreciate help with these issues :-)However after part of the Itune update completed a message came up on the screen
saying "The feature you are trying to use is on a net work resource that is unavailable.
Which particular .msi file does the message go on to say cannot be found? (Several different .msi files might be mentioned in this context: itunes.msi, bonjour.msi, AppleSoftwareUpdate.msi, etc.) -
As it says, I got a Mac Book Pro from my company and I would like to update the apps on it. They are registered to a former employee's Apple ID, is there anyway for me to change it to my Apple ID? Or do all of the Apps need to be re-purchased?
Welcome to the Apple Support Communities
You must repurchase the applications because you can't transfer programs from an Apple ID to another one -
I am trying to move a file from a folder to another folder.
here is my code:
//storage of the all files
string[] folderContentNames = Directory.GetFiles(@"C:\Users\Jonah\Desktop\Test Pictures");
private void historyPictureBox_Click(object sender, EventArgs e)
destinationFile = @"C:\Users\Jonah\Desktop\Test Test";
File.Move(folderContentNames[1], destinationFile);
updateListBoxFileName();
updateImageBox();
each time I hit the bolded underlined part I get that error message.
if you need anything else just ask.
Thanks in advance,
Thor OrbHi Thor,
If you want to move a file from a folder to another folder, I think you could get the sourcePath and TargetPath. The code below shows a simple demo:
string[] folders = Directory.GetFiles(@"D:\Test\VSC#\01\WindowsFormsApp\WindowsFormsApp\Test");
string desFile =Path.Combine( @"D:\Test\VSC#\01\WindowsFormsApp\WindowsFormsApp\Test - Copy\"+Path.GetFileName(folders[1]));
File.Move(folders[1], desFile);
In addition, the link below might be useful to you:
# How to: Copy, Delete, and Move Files and Folders (C# Programming Guide)
>> The process cannot access the file because it is being used by another process
The message seemed that the file was opened in other process. Did you operate the file with other code?
I think you could check if the files and the folders were opened, and review your codes if they were used in other places.
If you have any further questions, please feel free to post in this forum.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a
href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.
Ya, Thanks I figured about the path and destation. yes I am using the file in another area, the file is an image jpg and I am displaying it in a picture box. Now I have been doing a little research I see a command called Dispose() and this is suppose to
release the handle on the image, but I can seem to figure out have to use it correctly.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Collections;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Scanned_Picture_Ogranizer
public partial class Form1 : Form
//storage of the all files
string[] folderContentNames = Directory.GetFiles(@"C:\Users\Jonah\Desktop\Scan Project Testing\Test Pictures", "*.jpg");
//List<string> folderContentList = folderContentNames.ToList();
private List<string> folderContentList = new List<string>();
Bitmap currentImage;
Bitmap placeHolder;
public Form1()
InitializeComponent();
convertingArrayToList();
startUpData();
string sourceFile = @"C:\Users\Jonah\OneDrive\My Programming Projects\Scanned Picture Organizer Project\Test Pictures";
string destinationFile = "";
private void moveButton_Click(object sender, EventArgs e)
private void startUpData()
//placeHolder = new Bitmap(folderContentList[0]);
//currentImage = (Bitmap)placeHolder.Clone();
// Image loadImage = new Bitmap(pictureClones[0]);
// currentFilePictureBox.Image = loadImage;
int numberOfFilesLeft = folderContentNames.Length;
foreach (string name in folderContentNames)
fileNamesListBox.Items.Add(name);
fileNameTextBox.Text = folderContentNames[0];
numberOfFilesLeftTextBox.Text = numberOfFilesLeft.ToString();
///loadImage.Dispose();
//FileStream currentImage = new FileStream(folderContentList[0], FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
private void convertingArrayToList()
foreach (string listName in folderContentNames)
folderContentList.Add(listName);
private void selectingImageFromListBox()
private void updateImageBox()
Bitmap currentImage = new Bitmap(folderContentList[0]);
currentFilePictureBox.Image = currentImage;
currentImage.Dispose();
private void updateListBoxFileName()
fileNamesListBox.Items.RemoveAt(0);
fileNameTextBox.Text = folderContentList[0];
// numberOfFilesLeftTextBox.Text = numberOfFilesLeft.ToString();
private void historyPictureBox_Click(object sender, EventArgs e)
destinationFile = @"C:\Users\Jonah\Desktop\Scan Project Testing\Test Test\";
File.Move(folderContentList[0], destinationFile + System.IO.Path.GetFileName(folderContentList[0]));
folderContentList.RemoveAt(0);
updateImageBox();
updateListBoxFileName();
when I first start the program the first picture displays, but when I trigger historyPictureBox_Click(), it does that error again. Another things is that I already looked at that link and it didn't help.
I just super confused, I would like your help on this.
Thanks,
Thor Orb -
Hi,
We are having issues with Server 2012 R2 SMB shares.
We try to write some changes to a file, but we first create a temporary backup in case the write fails. After the backup is created we write the changes to the file and then we get an error:
The process cannot access the file '\\server\share\test.txt' because it is being used by another process.
It looks like the backup process keeps the original file in use.
The problem doesn't always occur the first time, but almost everytime after 2 or 3 changes. I have provided some code below to reproduce the problem, you can run this in a loop to reproduce.
The problem is that once the error arises, the file remains 'in use' for a while, so you cannot retry but have to wait at least several minutes.
I've already used Process Explorer to analyze, but there are no open file handles.
To reproduce the problem: create two Server 2012 R2 machines and run the below code from one server accessing an SMB share on the other server.
Below is the code I use for testing, if you reproduce the scenario, I'm sure you get the same error.
We are not looking for an alternative way to solve this, but wonder if this is a bug that needs to be reported?
Anybody seen this behavior before or know what's causing it?
The code:
string file =
@"\\server\share\test.txt";
if (File.Exists(file))
File.Copy(file, file +
".bak", true);
File.WriteAllText(file,
"Testje",
Encoding.UTF8);
The error:
System.IO.IOException: The process cannot access the file '\\server\share\test.txt' because it is being used by another process.Hi,
There is someone else having the same issue with yours. You could try code in the article below:
“The process cannot access the file because it is being used by another process”
http://blogs.msdn.com/b/shawncao/archive/2010/06/04/the-process-cannot-access-the-file-because-it-is-being-used-by-another-process.aspx
If you wonder the root cause of the issue, the .NET Framework Class Libraries forum can help.
Best Regards,
Mandy
If you have any feedback on our support, please click
here .
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
I am working with a client who is attempting to backup to a NAS device
The device is a linksys NSS6000 (Cisco device).
It’s a dual 1Gbit LAN device that supports CIFS / FTP and NFS transfers. It has only 1Gbit lan connected.
The device has 4 * 500 gb sata drives in raid 1 attached.
Cables go from cat 5 to fiber back to cat5. (The NAS is located at a neighboring office) The switches are 1gbit.
Server is a win2k8r1 fully up to date.
When backing up to the NAS device, the following error occurs:
Running backup of volume Local Disk(D:), copied (86%).
Running backup of volume Local Disk(D:), copied (90%).
Running backup of volume Local Disk(D:), copied (94%).
Running backup of volume Local Disk(D:), copied (98%).
Backup of volume Local Disk(D:) completed successfully.
Backup stopped before completing.
Summary of backup:
Backup stopped before completing.
The process cannot access the file because it is being used by another process.
If we redirect the backup to a folder on a 2008 share, the backup completes successfully.
Only when backing up to the linksys NSS6000 does the error occur.
No other backup processes are writing to the NAS device so I can't understand why the process thinks the file is
being used by another process.
One thing we did notice that when the backup to the NAS device occurs, throughput is about 150 mbit average
On the 2008 server shares we successfully backup to, the through put is 500 mbit. Not sure if that is important, but
might be worth mentioning.
The following event log entry was noted at the end of the backup.
The description for Event ID '519' in Source 'Microsoft-Windows-Backup' cannot be found.
The local computer may not have the necessary registry information or message DLL files to display the message,
or you may not have permission to access them. The following information is part of the
event:'2009-05-12T10:13:31.617Z', '', '2147942432', '%%2147942432'
Any ideas?
Thanks..MichaelI am also seeing the same problem backing up nightly to a brand new NAS device (WD My Book Live)
All the error codes are the same as those in this thread.
From Windows Event Viewer:
The backup operation that started at '2011-03-25T06:00:19.811302700Z' has failed with following error code '2147942432' (The process cannot access the file because it is being used by another process.). Please review the event details
for a solution, and then rerun the backup operation once the issue is resolved.
Fault bucket 659897467, type 5
Event Name: WindowsBackupFailure
Response: Not available
Cab Id: 0
Problem signature:
P1: Backup
P2: 6.1.7600
P3: 0x80070020
P4: 7
P5:
P6:
P7:
P8:
P9:
P10:
Attached files:
C:\Windows\Logs\WindowsBackup\WindowsBackup.1.etl
These files may be available here:
C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_Backup_6957d65de91fc4a853ecc7c78914bf7351fff0d1_14578325
Analysis symbol:
Rechecking for solution: 0
Report Id: dd480bf2-56a6-11e0-ae81-00217099bf56
Report Status: 0
From Report.wer in C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_Backup_6957d65de91fc4a853ecc7c78914bf7351fff0d1_14578325
Version=1
EventType=WindowsBackupFailure
EventTime=129455071508181139
Consent=1
UploadTime=129455071508201140
ReportIdentifier=dd480bf2-56a6-11e0-ae81-00217099bf56
Response.BucketId=659897467
Response.BucketTable=5
Response.type=4
Sig[0].Name=Operation
Sig[0].Value=Backup
Sig[1].Name=AppVer
Sig[1].Value=6.1.7600
Sig[2].Name=HRESULT
Sig[2].Value=0x80070020
Sig[3].Name=TargetType
Sig[3].Value=7
DynamicSig[1].Name=OS Version
DynamicSig[1].Value=6.1.7600.2.0.0.256.48
DynamicSig[2].Name=Locale ID
DynamicSig[2].Value=1033
State[0].Key=Transport.DoneStage1
State[0].Value=1
State[1].Key=DataRequest
State[1].Value=Bucket=659897467/nBucketTable=5/nResponse=1/n
FriendlyEventName=WindowsBackupFailure
ConsentKey=WindowsBackupFailure
AppName=Windows host process (Rundll32)
AppPath=C:\Windows\System32\rundll32.exe
ReportDescription=Windows Backup failure -
I am installing creative the cloud Illustrator desktop app on a machine with windows 7 64 bit running in a domain environment. The download starts and takes about runs for a bout 10 minutes and then stops with the error: DF024: Unable to preserve original file at "C:\Program Files\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\AdobeLinguistic.dll" Error 32 The process cannot access the file because it is being used by another process.(Seq 1352)
I am logged in as a network administrator and there are no other apps except a web browser (Chrome) running. There are no other users logged into the machine.
How can I see what other process is using the needed file so that I can fix it?
ThanksMelissaB34 it looks like you already are reviewing your installation log files but you can find more information at Troubleshoot install issues with log files | CC - http://helpx.adobe.com/creative-cloud/kb/troubleshoot-install-logs-cc.html. From the error you have posted it appears that your current User account is either unable to update C:\Program Files\Adobe\Adobe Illustrator CC 2014\Support Files\Contents\Windows\AdobeLinguistic.dll or does not have sufficient file permissions to do so. Since you mentioned you are on a domain please ensure that you are working with your I.T. department and have correct access to this directory.
You may want to also consider logging in under a local administrator account to see if you face the same difficulties. This would help you determine if you are facing a file corruption issue or file permission issue. -
Hi,
I've a master package that calls other packages with an Execute Package Task. Sometimes we have an error: "The process cannot access the file because it is being used by another process" and sometimes not. It seems random.
We are working on a Terminal Server and the SQL Server database engine and the files are placed on another server. It seems that the errors doesn't occu when we run the packages on the server with a job. We can't log onto the windows server on this machine..
HennieI've seen this myself. On most occasions an immediate rerun would fix the issue. As stated this happens only when we try to run this from BIDs. From SQL agent job it always runs fine.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
I recently purchased the newest nano. I have 3 other nano's and iPad iPhone, oh and iPod touch. When I plug in nano to my mac I get the message "iPod cannot update because it contains files that are used by another application. How can manage this?
dedonred wrote:
"iPod cannot update because it contains files that are used by another application.
It means that nano was used on a third-party software or synced from different computer to sync music. Does that nano show in iTunes? If yes, then restore completely. If not, then you may need to head to Apple Store and see what they can do. -
Hey,
I have a powershell script where I first use Get-childitem to receive a number of files.
Then I do some stuff with it and try to move the file afterwards.
Unfortunately if I am using a lot of files I receive very often the error:
The process cannot access the file because it is being used by another process.
Even -Force parameter does not help further.
Based on my look around it is not used by another process.
I think it is still 'in use' by powershell from script commands previously.
Is there any way to 'see' if the file is still in use currently and wait for this to end?
Or can I 'close' the current usage of the file?
Thank you :)Hey,
Thank you.
I build the following function.
But either the $return = $true I receive "The process cannot access the file because it is being used by another process." when I try to move-item... :(
Function Wait-FileUnlock($FilePath){
Write-Host " "
$FileInfo = New-Object System.IO.FileInfo $($FilePath)
DO{
try{
$fileStream = $fileInfo.Open([System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::Read)
$return = $true
catch{
Start-Sleep -Milliseconds 5
Write-Host "." -NoNewline
$return = $false
While($return -ne $true)
$Error
return $return
Another functions is:
Function Wait-FileUnlock($FilePath){
Write-Host " "
DO{
$Error.Clear()
Rename-Item $FilePath $FilePath -ErrorAction SilentlyContinue | Out-Null
Start-Sleep -Milliseconds 5
Write-Host "." -NoNewline
While($Error.Count -ne 0)
This one waits .. but it seems not to end waiting at any time :( -
When i am trying to delete the Virtual Machine folder/directory i get the below error. Virtual machine is turned off
V:\>rmdir ME-EXCAS01 /s
ME-EXCAS01, Are you sure (Y/N)? y
ME-EXCAS01\ME-EXCAS01\Virtual Machines\1B1FD14E-B3F0-4232-9F96-2A871E879CD6.xml
- The process cannot access the file because it is being used by another process
How to delete the whole folder ?
ThanksAlso, if your VM has snapshots and you delete it, you must wait for the snapshots to finish merging - the VHD files will be locked until then.
Brian Ehlert
http://ITProctology.blogspot.com
Learn. Apply. Repeat. -
Why am I getting an error message saying my files ( that I created in 5.5 ) can not be opened because they are created in CS6? Says I have to open in 6 and back save to 4.
Ask in the ID forum and provide at least some useful info like system specs, what's contained in the files, where they are stored...
Mylenium -
I just got an iPhone 5S, now when I try to use my old iPad the apps won't work because they are syncing with my new phone. Can I have the same account for an old iPad and a new iPhone?
Connect your iPad to iTunes on the computer you usually Sync with and “ Check for Updates “...
If an Update Appears Install it... if not... you are up to date for your particular Device...
See the Using iTunes Section Here...
How to update your iPhone, iPad, or iPod touch
Make sure you have the Latest Version of iTunes (v11) Installed on your computer
iTunes free download from www.itunes.com/download -
i've downloaded some free games for my iphone4 but they are using my internet because they have ads. does anyone know if there are any games that don't have these ads and don't require internet AT ALL?and if i disable my internet connexion, does it help?
Thank you. I put it in airplane mode like you suggested, but it looks to me like all the applications and ads are still running. Anyway, I'm just gonna play when I'm really really bored and use them as less as possible. Thank you again for your quick answer.
Maybe you are looking for
-
Can Photoshop CS6 Extended save uncompressed DICOM files?
In CS4 and CS5 Extended layered documents saved as DICOM (.dcm) were uncompressed and could be opened in another imaging program that I use frequently (ImageJ) without complaint. It appears that CS6 Extended saves DICOM files in a compressed format w
-
I'm getting a new laptop and putting my ipod software on it- one question
Okay, I know that I have to put my ipod software on my new laptop so that it will recognize my ipod- but will it download my music and videos onto my itunes on my new computer then? Or do I need to save my music and videos and send them another way?-
-
I tried downloading the Lion 10.7 software and contacted customer support thinking I needed an upgrade to a higher processor speed. He stated I needed to download using an eternet cable rather than wireless. So, I connected the cables and the softwar
-
How do I eliminate the "community Toolbar" compatibility notice/error??
Hi everyone! Thanks for reading and I look foreward to all useful suggestions! My situation: With Safari running... 5.1.7 (but even on 5.1.6) at some point i downloaded or installed some "community toolbar....i imagine it was a throw in with some
-
Is this scam - spam???
SKYPE Communications 2 Waterhouse Sq (140 Holborn), London, Greater London, EC1N 2ST, United KingdomDear Skype User,Your Lucky number #3598# has won for you £259,000.00 GBP via the first quarter raffle draw on the on-going SKYPE AWARD PROMO.Please pr