Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
82 views

Checks for removing files after X amount of days

I am trying to remove files in my directory if they are over 30 days. However, I don't know what other checks I need to do. The examples I found online weren't very thorough besides just subtracting ...
JThao's user avatar
  • 57
3 votes
0 answers
81 views

Python script that getting list of all files with specific ext starting from the current folder. Using timer for reporting about the process

I am using a function that returns a list of all files (full path for each of them) with the given extension in the given folder and all subfolders. As the process is quite long and user can get ...
SlavaB's user avatar
  • 31
5 votes
2 answers
311 views

Program to delete directories that do not contain a file

I'm an intern and have an ETL project I'm doing in python. Part of it is to make sure after I move files I delete empty directories. I wrote this code to clean up directories that are empty and in ...
lc74's user avatar
  • 51
5 votes
1 answer
104 views

Combining CSV files of simulation results

This script is a subset of a larger script where I have the output of many test simulations in the form of CSVs. Each file starts with the model name and includes the number of elements in my file. ...
dylanjm's user avatar
  • 245
1 vote
1 answer
2k views

List directories, subdirectories and files, while ignoring some dirs

In my application, the user may or may not want to ignore some directories. I can do that, but it seems like I am repeating myself. Does anyone have an idea to refactor that? ...
gsamaras's user avatar
  • 292
1 vote
1 answer
60 views

Create directories for outputs based on setting

I have a dict with a series of bools to specify if a particular aspect of my program will be run (e.g. settings['A'] and ...
agf1997's user avatar
  • 173
4 votes
3 answers
3k views

os.walk listing directory

I use this script to get a list of all my photos in a folder and its subfolders. However, the program seems to be really slow. There are 50,000 .jpg pictures in this folder and subfolders. I can ...
MALKAVIAN's user avatar
8 votes
1 answer
849 views

Track changes inside a directory

I have built a Python 2.7 script to track all file and subdir changes inside a nominated directory. It is used with directories that have multiple levels of subdirectories, hundreds of thousands of ...
Thanassis's user avatar
  • 372
5 votes
1 answer
1k views

Random MP3 Selector and Player

So, I am either a glutton for punishment, or I have no life, but I wrote a script to answer a question over on Ask Ubuntu as a solution for selecting a random MP3 file in a given directory, and ...
Thomas Ward's user avatar
  • 2,538
2 votes
1 answer
4k views

Recursively list files within a directory

I have the following code to recursively list files within a directory: ...
FXux's user avatar
  • 175
2 votes
2 answers
617 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
3 votes
1 answer
147 views

ArcPy script to analyze land use in counties

We have written a Python script using arcpy modules. It is was written by Python beginners and many parts of the code are written in 'unpythonic way'. The goal is ...
cpt_python's user avatar
1 vote
1 answer
1k views

Foldify - A Python Folder Tree Manager Tool

The goal was to create a tool to help manage folders structures, and allow me to create templates of this folders and store them as a JSON template. The following functionalities have been implemented:...
gtalarico's user avatar
  • 163
2 votes
1 answer
1k views

Simple program that copies just new files from one directory to another

I'm doing a Python course for beginners, and the last assignment was to create a program using shutil and wxpython that can copy new files (created in the last 24 hours) from one folder into another, ...
Nathan R's user avatar
  • 183
7 votes
3 answers
4k views

Accessing files in a child directory in Python 2.7.x

I have written the below script for use in Python 2.7.x. In essence, I want the script to access a folder contained within the directory the script is and then add all files contained within to a list....
thefragileomen's user avatar

15 30 50 per page