5 Replies - 433 Views - Last Post: 22 September 2014 - 09:37 PM Rate Topic: -----

#1 KnifeTea  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 135
  • Joined: 21-November 13

PowerShell - Access / Alter files

Posted 28 December 2013 - 11:41 AM

I'm getting a couple of error - one of them is that the file name is too long and the other is that the folder is in use elsewhere (and as a result I can't move it to another folder / delete etc)

I've tried to mount the folder to a drive letter in PowerShell to see if that made any difference but I still get the error that the file name is too long...

Here's an image of the PowerShell error :

Posted Image

and here's an error from the GUI about the folder being in use elsewhere :

Posted Image

I'm not sure how to get round this...

cheers

Is This A Good Question/Topic? 0
  • +

Replies To: PowerShell - Access / Alter files

#2 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3617
  • View blog
  • Posts: 12,442
  • Joined: 12-December 12

Re: PowerShell - Access / Alter files

Posted 28 December 2013 - 12:24 PM

Is the filename and/or path too long? If so, is it not possible to reduce the names of subfolders, or move the file elsewhere? Rather than mounting a drive I would test this by temporarily moving the file or folder nearer.

I'm not a PowerShell guy but I assume you can change the current (active) directory, and then change it back again? This may help.

If it is not, actually, a problem with the length, then maybe there is an odd character causing a problem.
Was This Post Helpful? 0
  • +
  • -

#3 KnifeTea  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 4
  • View blog
  • Posts: 135
  • Joined: 21-November 13

Re: PowerShell - Access / Alter files

Posted 28 December 2013 - 01:59 PM

View Postandrewsw, on 28 December 2013 - 12:24 PM, said:

Is the filename and/or path too long? If so, is it not possible to reduce the names of subfolders, or move the file elsewhere? Rather than mounting a drive I would test this by temporarily moving the file or folder nearer.

I'm not a PowerShell guy but I assume you can change the current (active) directory, and then change it back again? This may help.

If it is not, actually, a problem with the length, then maybe there is an odd character causing a problem.


Argh, forest for the trees... I moved the folder containing the file with the massive name onto the desktop and deleted it from there... So that's good, cheers andrew.
Was This Post Helpful? 0
  • +
  • -

#4 JonBernal  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 199
  • Joined: 14-March 09

Re: PowerShell - Access / Alter files

Posted 05 March 2014 - 08:36 PM

View PostKnifeTea, on 28 December 2013 - 01:59 PM, said:

View Postandrewsw, on 28 December 2013 - 12:24 PM, said:

Is the filename and/or path too long? If so, is it not possible to reduce the names of subfolders, or move the file elsewhere? Rather than mounting a drive I would test this by temporarily moving the file or folder nearer.

I'm not a PowerShell guy but I assume you can change the current (active) directory, and then change it back again? This may help.

If it is not, actually, a problem with the length, then maybe there is an odd character causing a problem.


Argh, forest for the trees... I moved the folder containing the file with the massive name onto the desktop and deleted it from there... So that's good, cheers andrew.


The problem is probably because the file path is over 256 characters long, which for some reason Windows can't handle.

Next time try mapping it to a network drive, then work with it. I've found that creating a New-PSDrive doesn't work the same way, so don't create a PSDrive but do a net use X C:\path instead.

This post has been edited by JonBernal: 05 March 2014 - 08:37 PM

Was This Post Helpful? 0
  • +
  • -

#5 mrp123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 22-September 14

Re: PowerShell - Access / Alter files

Posted 22 September 2014 - 09:29 PM

View PostJonBernal, on 05 March 2014 - 08:36 PM, said:

View PostKnifeTea, on 28 December 2013 - 01:59 PM, said:

View Postandrewsw, on 28 December 2013 - 12:24 PM, said:

Is the filename and/or path too long? If so, is it not possible to reduce the names of subfolders, or move the file elsewhere? Rather than mounting a drive I would test this by temporarily moving the file or folder nearer.

I'm not a PowerShell guy but I assume you can change the current (active) directory, and then change it back again? This may help.

If it is not, actually, a problem with the length, then maybe there is an odd character causing a problem.


Argh, forest for the trees... I moved the folder containing the file with the massive name onto the desktop and deleted it from there... So that's good, cheers andrew.


The problem is probably because the file path is over 256 characters long, which for some reason Windows can't handle.

Next time try mapping it to a network drive, then work with it. I've found that creating a New-PSDrive doesn't work the same way, so don't create a PSDrive but do a net use X C:\path instead.


If I am not wrong 256 characters is the limit for file name, I have come across this issue not able recall the solution but I have bookmarked one link where you could find solution http://powershelltut...ystem-Copy-file
Was This Post Helpful? 0
  • +
  • -

#6 E l e c t r i c  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 5
  • View blog
  • Posts: 48
  • Joined: 18-September 14

Re: PowerShell - Access / Alter files

Posted 22 September 2014 - 09:37 PM

Did you encrypt the directory? I have had a GUI error similar to that because the directory was encrypted. If so you have to remove the encryption and then delete the file. Windows has some sort of file protecting agent that prevents files from being deleted that are encrypted. Hopefully this helps?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1