Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
1k views

Recursive os.scandir() for copying/moving files preserving subdirectories

This is modified from the general recursive solution here: https://stackoverflow.com/a/54544211/42346 to, more specifically, copy/move files with a given extension from one directory to another whilst ...
mechanical_meat's user avatar
2 votes
2 answers
613 views

Decompress files files in a directory recursively

Currently I'm trying to redo this code to avoid the breaking line because of the 80 characters rule: ...
Amanda Ferrari's user avatar
6 votes
2 answers
9k views

Finding all non-empty directories and their files on an SFTP server with Paramiko

The purpose of the following function is to find all non-empty directories, and the files in those non-empty directories. It recursively checks each directory on an SFTP server to see if it has any ...
Matthew Moisen's user avatar
4 votes
2 answers
7k views

Alternate method of iterating than os.walk

Recently, I became tired of how slowly os.walk seems to run (really, it should be called os.crawl), and made something recursive ...
Cease's user avatar
  • 143
4 votes
1 answer
3k views

Python script to find large folders

I wrote this script a few days ago to find all files which were taking up over a certain threshold of memory on the hard drive. A hard drive on one of my computers had just 6 GB left, so I needed to ...
asteri's user avatar
  • 4,929
3 votes
3 answers
2k views

Python script to touch files of a particular pattern in all folders of a given name

The intent of this script is to hunt down all "*/testResults/*.xml" files and touch them, so that our build system doesn't issue errors that the files are too old (...
benjymous's user avatar
  • 131