ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Must be too easy ? or Windows 10 does not like it

(1/3) > >>

questorfla:
This is something that 4WD already wrote about a year ago and i have used it as needed on a Windows 7 system.  But i cannot get it to work for some reason on windows 10 with the same requirements.

It should be as simple as a one liner  (or maybe 2)

In a given directory there are sub-folders named "A" to "Z".  In this same directory many people just dump their files without alphabetically filing them. 
This little batch script just went through the loose files in the folder, extracted the first letter of any file it found and moved that file to the correct folder based on its first letter.

So "C:\Lots-Of-Files\Smith, Adam.txt" would get moved into "C:\Lots-Of-Files\S\Smith, Adam.txt" with the overwrite switch to ON and no permission asking.
the "A"to "Z" sub folders are already there and in that same directory.  It would be preferable to just set the variables to be run from the local directory
(of course the ends up moving the bat file too but that is OK, i name it "ZZfiler.bat" so I know where to go get it next time i need it :)

anyway, 4WD's solution was a little more complex as it would even create the alphabetic sub-folders when needed which is not really required as every directory i have to use this on already has A to Z in it.  And like I said, it worked fine on Win7 but on Win 10 it just blinks and does nothing.?

4wd:
Sounds like an access problem, ie. not having the right permissions.

Powershell version:

AlphaMove.ps1

--- Code: PowerShell ---$items = (Get-ChildItem -File) for ($i = 0; $i -lt $items.Count; $i++) {  if ($items[$i] -match "^[0-9 ]") {    $path = "A"  } else {    $path = $items[$i].BaseName.Substring(0, 1)  }  if ($items[$i].BaseName -ne "AlphaMove") {    if (!(Test-Path $path)) { New-Item $path.ToUpper() -ItemType Directory | Out-Null }    $dest = ".\" + $path    Move-Item $items[$i] $dest  }}
Run it from within the folder ... and it won't move itself ;)

wraith808:
if you're going to run a powershell script from within the folder, don't forget to give yourself execute permissions using the Set-ExecutionPolicy cmdlet.  They have it pretty much locked down in Windows 10.

4wd:
err yeah, forgot that bit - if you'd rather not worry about that, since it has no input/output requirements you could run it from a shortcut, (in the same folder), with the Target set as:


--- Code: Text ---%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy bypass -File "AlphaMove.ps1"

Stoic Joker:
In a given directory there are sub-folders named "A" to "Z".  In this same directory many people just dump their files without alphabetically filing them.  This little batch script just went through the loose files in the folder, extracted the first letter of any file it found and moved that file to the correct folder based on its first letter.-questorfla (September 15, 2015, 04:01 PM)
--- End quote ---


Scripting is nice, but IMO you're solving the wrong problem. The permissions on the parent directory should be set as below for both Authenticated and Domain Users.



Subfolder permissions will need to be reset (to once again restore write access) after doing this, but the end result is forced honesty. Because nobody can create files/folders in the root on the tree...which forces them to put stuff where it belongs. They can however delete/move their existing junk to where it belongs. And if - by chance - you don't trust them to do the cleaning...omit the delete permissions.

We had huge problems here when I first started, because of the exact reason you describe here ... And then suddenly one day...the problem just vanished (by force..). :D


[/BOFH Mode]

Navigation

[0] Message Index

[#] Next page

Go to full version