Skip to content

Recursively traverse a given directory and identify which filepath are greater than a given length

Notifications You must be signed in to change notification settings

jcfr/list-longest-paths

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

List Longest Paths

Overview

This script recursively traverse a given directory and identify which filepath are greater than a given length.

This is particularly useful when trying to identitify which files living in a windows source or build tree are causing trouble due to the Maximum Path Length Limitation.

Usage

$ ./list_longest_paths.py -h
Usage: list_longest_paths.py [options] <directory>

Options:
  -h, --help            show this help message and exit
  -l MINIMUM_LENGTH, --minimum-length=MINIMUM_LENGTH
                        specify minimum length to consider when listing the
                        longest paths
  -v, --verbose         Print verbose information
  --extra-verbose       Print extra verbose information

By default MINIMUM_LENGTH is 259 (MAX_PATH -1) . See Maximum Path Length Limitation.

$ ./list_longest_paths.py ~/Projects/Slicer-AHM-Superbuild-Debug/
[262] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/CTK-build/CTK-build/Libs/Visualization/VTK/Widgets/CMakeFiles/CTKVisualizationVTKWidgetsPythonQt.dir/generated_cpp/org_commontk_CTKVisualizationVTKWidgets/org_commontk_CTKVisualizationVTKWidgets_module_init.cpp.o
[281] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/Modules/Loadable/EMSegment/Qt/Widgets/CMakeFiles/qSlicerEMSegmentModuleWidgetsPythonQt.dir/generated_cpp/org_slicer_module_qSlicerEMSegmentModuleWidgets/org_slicer_module_qSlicerEMSegmentModuleWidgets_module_init.cpp.o
[277] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/Modules/Loadable/EMSegment/Qt/Widgets/CMakeFiles/qSlicerEMSegmentModuleWidgetsPythonQt.dir/generated_cpp/org_slicer_module_qSlicerEMSegmentModuleWidgets/moc_org_slicer_module_qSlicerEMSegmentModuleWidgets_all.cpp.o
[274] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/Modules/Loadable/EMSegment/Qt/Widgets/CMakeFiles/qSlicerEMSegmentModuleWidgetsPythonQt.dir/generated_cpp/org_slicer_module_qSlicerEMSegmentModuleWidgets/org_slicer_module_qSlicerEMSegmentModuleWidgets_init.cpp.o
[...]

Simple.

Note also that passing the --verbose options will provide you with more details:

$ ./list_longest_paths.py -v -l 300 ~/Projects/Slicer-AHM-Superbuild-Debug/
[318] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/Modules/Loadable/TractographyDisplay/Widgets/CMakeFiles/qSlicerTractographyDisplayModuleWidgetsPythonQt.dir/generated_cpp/org_slicer_module_qSlicerTractographyDisplayModuleWidgets/org_slicer_module_qSlicerTractographyDisplayModuleWidgets_module_init.cpp.o
[302] /home/jchris/Projects/Slicer-AHM-Superbuild-Debug/Slicer-build/Modules/Loadable/VolumeRendering/Widgets/CMakeFiles/qSlicerVolumeRenderingModuleWidgetsPythonQt.dir/generated_cpp/org_slicer_module_qSlicerVolumeRenderingModuleWidgets/org_slicer_module_qSlicerVolumeRenderingModuleWidgets_module_init.cpp.o

Analysis summary
	Found 2 files having length >= 300 by recursively traversing directory [/home/jchris/Projects/Slicer-AHM-Superbuild-Debug/]
	Number of checked paths is 85966

Installation

Download the script.

Contributing

Once you've made your great commits:

  1. Fork list-longest-paths
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your branch - git push origin my_branch
  4. Submit a Pull Request
  5. That's it!

Meta

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Recursively traverse a given directory and identify which filepath are greater than a given length

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published