All Questions

Tagged with
Filter by
Sorted by
Tagged with
19 votes
2 answers
34k views

Simple backup script in Python

Since rsync lacks compression and I'm not a big fan of rdiff, I thought I'd try my own little backup script. Since I'm very ...
  • 958
17 votes
2 answers
21k views

Python Back-Up Script

I wrote this script to backup some important files. It backs up the files to a local folder as well as to an external hard drive. It creates a new subdirectory which has its name constructed with ...
  • 4,869
16 votes
6 answers
3k views

A file class for Python

This is the entire code segment. All the functions for file operations are working perfectly. I just need a professional to help me clarify that am following good standards, documentation, etc., ...
15 votes
4 answers
1k views

Python tool to organize downloaded media files

I'm making a file management project that I eventually want to be automated later in the future (once I learn how to). What it does is take files from my download folder and move those files to the ...
12 votes
2 answers
870 views

A minimal CLI password storage and retrieval manager

Its primary function is to retrieve+copy a PW to your clipboard. It'll also add, update, delete key/value(accountName/password) pairs from a JSON formatted dictionary(separate .txt file). It's ...
  • 287
12 votes
3 answers
765 views

Scanning a directory for plugins and loading them

I'm working on a simple dictionary tool, with a base class that can be extended by plugins to represent different dictionaries. The plugins are organized in the filesystem like this: ...
  • 110k
11 votes
3 answers
1k views

Path shortener for GUI application

I need to display a path within a GUI application. Displaying the whole path would be an overkill, so I made a custom path shortener. ...
  • 557
11 votes
1 answer
238 views

Creating an app for selecting a folder

The script creates a simple app with a GUI containing an input field and a button to select a folder. On startup a default value is set to the input field. If the user types a value or selects a ...
  • 95
10 votes
2 answers
2k views

Filtering log files from a server

I have made a program in Python to do a filter of log files from a server. What I would like is some guidance on how this code could be optimized, streamlined or 'short-handed' so my 'pythonic' ...
10 votes
2 answers
343 views

Reading a proprietary file system and creating files

The goal of this software is to read the proprietary file system index of a digital video recorder and to carve all of the video chunks into files within a dated directory structure. I'm not very ...
10 votes
2 answers
191 views

Get Wikimedia attributions for images

We are using images from Wikimedia commons for some of Cardshifter's game artwork. I selected some art for each card to make a .jpg file to use in the game clients, ...
  • 20.3k
10 votes
1 answer
204 views

Deduplication by hard-linking files in multiple directories

About a year ago, I wrote a Python script that enumerates all the files in a directory, partitions them based on a couple of criteria (file size, a custom byte-signature of the file, hash, ...) and ...
  • 363
9 votes
3 answers
1k views

Adding data from multiple Excel files to two lists

I have 5 nested for loops below, to add rows of data from multiple files to one of two lists. Is there a more pythonic way of doing this? I've come across an ...
user avatar
9 votes
2 answers
10k views

Find files by pattern and copy to target location

This is my solution to the Chapter 9 exercise in Automate the Boring Stuff: Selective Copy Write a program that walks through a folder tree and searches for files with a certain file extension ...
  • 93
9 votes
3 answers
262 views

Collate votes on MP3 files to list them by popularity

For my first Python project, I decided to create a script that would automatically collate MP3 files into a music countdown. I wanted to 'learn by doing', so I dived straight in and used the Python ...
  • 175
9 votes
2 answers
83 views

Find missing web-pages

You are writing your web-page and relentlessly adding links, as you think that links are the best thing a web-page can offer. The fact is that you write links even to pages that do not exist just yet,...
  • 27.3k
8 votes
2 answers
1k views

List files in a directory

I have folder1 that contains other folders (which may contain other folders etc). This process stops at some point where a folder contains only files, and some of ...
  • 417
8 votes
4 answers
1k views

Making a directory structure for a web project

I have always been into HTML and CSS so I decided to give programming a try. I installed Python because I heard it is the best first programming language. So I made this program just now and I'm super ...
8 votes
3 answers
189 views

MP3 Vote Collator - Final

Here is the completed code for my first Python project, for which I received some help and feedback here: Collate votes on MP3 files to list them by popularity Seeing as there have been considerable ...
  • 175
8 votes
1 answer
7k views

Keeping remote folders in sync with local ones

This started as a hacked-together tool to remove annoyances I was facing with experimenting with code on live remote servers, then getting that code into my development environment after experimenting....
  • 183
8 votes
1 answer
2k views

Web-uploading of Cyrillic-named images

For web-uploading of Cyrillic-named images, I've written the script below: ...
8 votes
1 answer
2k views

Speech Recognition Part 3: Training the Neural Network

The last part of my speech recognition series: finally training my network. Here's the dataset I did it with (self-generated, small I know), and the code I used. After running this code (takes ...
  • 21.8k
8 votes
1 answer
748 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 ...
  • 372
8 votes
1 answer
1k views

Recursively search a folder for photos

The code below takes two command line arguments, an absolute folder path and integer, which is the minimum number of qualifying photos in each folder required to return a positive search result. ...
7 votes
2 answers
527 views

Retrieve filetype:pdf from library

I retrieved all the books in pdf from my library with a recursive function. ...
7 votes
3 answers
5k views

Finding and deleting duplicate files in a folder

The following code aims to identify and delete duplicate files in a folder. At first, files are compared by size, and then (if needed) by hash. The helper function ...
  • 235
7 votes
3 answers
48k views

Compare last modification time with specfied time

I'm writing a function in Python that compares the modification time of a file in Linux (using os.stat) with a specific time and compare the dates. If the modification date is older than the date I ...
user avatar
7 votes
1 answer
6k views

SMB Script which collect remote files, mount locations, unmount locations, and show directory file tree

I've written a script that is able to accomplish the following: mount/unmount a remote SMB location using the subprocess module List the file contents of a specified directory copy a single file out ...
7 votes
3 answers
3k 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....
7 votes
1 answer
636 views

Finding duplicate files on a disk using MD5

I started learning Python a month ago (used to write programs in Delphi before). Can you please take a look at my code and give me some tips what is good and what is bad in it? The aim is to find ...
7 votes
1 answer
924 views

Implementing a temporary data context manager

I implemented a context manager to handle temporary files and directories. ...
7 votes
1 answer
2k views

Replacing files with symlinks to other files

I wrote a little Python script to replace some files in usr/bin with symlinks to files in a different location. I wouldn't mind anyone telling me where I could do ...
  • 259
7 votes
1 answer
663 views

Folder Syncer in Python

I have made a script that syncs one folder to another. So if, for example, you saved some changes in a file in directory A, then that file would have the same ...
7 votes
2 answers
4k views

Pick a random file from a directory tree

I'm working on a python module to randomly choose a wallpaper for my desktop background among thousands of pictures in my photo library. I though I'd make a general function: ...
  • 230
7 votes
1 answer
1k views

Recursively listing files in Python

I'm a complete amateur at python. Other than hello world programs, this is the first thing I've ever done in Python. I cannot find a good way to make os.walk function the way I want it to so I ...
  • 227
7 votes
2 answers
14k views

Parsing locally stored HTML files

I am working with this code to parse through HTML files stored on my computer and extract HTML text by defining a certain tag that should be found: ...
7 votes
1 answer
2k views

Python code to identify structure of a text file

We have a department in our org that generates a lot of data in flat files, all with different formats. We are now trying to sort this data out and load into a database. As step 1, I am trying to ...
  • 103
6 votes
2 answers
756 views

Batch rename flac files

This is my first real program in python (and my first real program) and I would like to have input by some more advanced programmers on the code, on the writing style and on the amount of comments (is ...
  • 163
6 votes
4 answers
5k views

Check if a file path matches any of the patterns in a blacklist

I'm processing a list of files, and want to check the filenames against a list of regex, like: ...
  • 201
6 votes
2 answers
365 views

Scan similar files in different directories and report differences

I wrote a program in Python that scans all files in a directory, makes dictionaries with stuff like date of creation and a hash of the contents of a file. Then i scan another directory which is just a ...
  • 105
6 votes
1 answer
430 views

System backup on Linux

I've written this Python script to make regular backups of a Linux server. It works pretty well except that the script sometimes backups files more than one time, which is pretty strange and I don't ...
user avatar
6 votes
2 answers
2k views

Renaming PDF files based on given rules in a text file

I'm learing Python by writing a program to solve some housekeeping I do weekly, namely renaming PDF files according to rules given in a text file. My end goal is to have idiomatic Python, with full ...
6 votes
2 answers
651 views

"File Fix-it" challenge

I'm learning Python and have found this problem from Google Code Jam: How many mkdir commands does it take to construct a given directory tree: Input The first ...
  • 63
6 votes
3 answers
148 views

File duplicate finder

In an attempt to clean out my picture collection I made a script to find all duplicate files ...
6 votes
1 answer
871 views

Identify Duplicate Files

A friend of mine has the following issue. He has a nearly-full 1TB hard drive on which he keeps copies of all the pictures from his digital camera(s). However, he knows that he has copied the entire ...
  • 235
6 votes
2 answers
15k views

Move files to specific directory, according to file extension

I've written the following script ...
  • 602
6 votes
2 answers
9k views

Write MD5 hashes to file for all files in a directory tree

I'm ultimately trying to compare the MD5 hashes for files in two disparate directory trees to see if files are missing from one directory or the other. More broadly, I'm pushing photos from my DSLR ...
  • 163
6 votes
1 answer
5k views

Removing duplicate files in a given directory

The following code is a python script that removes duplicate files in a given directory. At first I considered the most basic thing: relying on identical names, but you might have 2 different files ...
  • 211
6 votes
2 answers
1k views

Account registration system for a quiz game

As part of a school project for ICT lessons, our class has been required to write a quiz program following certain criteria that has been set. The first part of this is a program that handles the ...
user avatar
6 votes
1 answer
196 views

Python script to clean out old files from a repository

I wrote the script below as my first python program that will be running in a production environment. Essentially this program looks at a source location and moves all the files to a destination ...

1
2 3 4 5