Handy use for Paper Folders with Long Paths via Powershell
Posted: 13 Sep 2016 06:29
Attribution for the very elegant Powershell solution goes to Rani Khier from: http://stackoverflow.com/questions/1269 ... in-windows
I paste this Powershell single-line script into a text file in my root directories for easy cut-paste access from any computer. (I also keep a snippets file, but I use this enough that it's convenient.):
This creates a list of full pathnames for files with length greater than 250 in paper_XY_longfilepath.txt in the directory from which you ran the Powershell command. (Obviously, it's trivial to change the "250" in the code.)
You may not want to run this from C:\ (or wherever else you have long system folders). If you do, you'll need to run Powershell as an administrator to avoid errors; this does recurse all subdirectories.
I prepared by putting the paper folder icon on my customize->toolbar. I also like having a column that shows "Len".
If you want to run the command from multiple locations, simply rename the resulting .txt files before move, or cut and paste the results into the first file.
You may or may not wish to edit the resulting file before opening as a paper folder, especially if there are system files or the length has gotten silly. (I like EditPad Lite because of its excellent regex and full line support. I also use "Everything" if I've used this in several locations, before renaming and moving en masse to the paper folder.)
I paste this Powershell single-line script into a text file in my root directories for easy cut-paste access from any computer. (I also keep a snippets file, but I use this enough that it's convenient.):
Code: Select all
Out-File paper_XY_longfilepath.txt ; cmd /c "dir /b /s /a" | ForEach-Object { if ($_.length -gt 250) {$_ | Out-File -append paper_XY_longfilepath.txt}}
You may not want to run this from C:\ (or wherever else you have long system folders). If you do, you'll need to run Powershell as an administrator to avoid errors; this does recurse all subdirectories.
I prepared by putting the paper folder icon on my customize->toolbar. I also like having a column that shows "Len".
- Open Powershell (elevated as required) from the directory you want to check; paste the snippet into the window and run it. It's very fast.
Copy the resulting .txt file to <XYPLORER>\Paper\
Hit the Paper Airplane icon to open "paper_XY_longfilepath.txt" as a paper folder.
Enjoy XY's ability to manage long paths and arbitrary file locations gracefully.
If you want to run the command from multiple locations, simply rename the resulting .txt files before move, or cut and paste the results into the first file.
You may or may not wish to edit the resulting file before opening as a paper folder, especially if there are system files or the length has gotten silly. (I like EditPad Lite because of its excellent regex and full line support. I also use "Everything" if I've used this in several locations, before renaming and moving en masse to the paper folder.)