Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading, and writing files.
5
votes
1answer
38 views
Recursively traverse directory tree and print all files
I want to build a small console program, that for given directory, will print (for now) all files inside that tree.
Here is an F# script that I came up with:
...
0
votes
1answer
28 views
12
votes
6answers
665 views
Bash script that lowercases files
I have the following bash script that:
Finds all files with .cfc and .cfm extension and converts them to lowercase
Stores the ...
0
votes
0answers
18 views
Event log implementation with TDD
Below is some code that implements an 'event log' whose purpose is to record events and periodically check that all events were recorded in chronological order. The collection of events must be ...
4
votes
2answers
50 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 ...
4
votes
1answer
336 views
Check if a file exists in a directory or parent
I want to check if a file exists in a given directory or in the parent one, so I wrote this code:
...
4
votes
4answers
149 views
Implemenation for concurrent file access (read/write)
I am developing an application that works with files and folder on a network share (similar to the windows explorer). The application is used by multiple users and provides some commands for modifying ...
3
votes
0answers
20 views
Movies wrapper script
I'm trying to do a nice script to be able to wrap my movies. Can you help me to improve it? I want to structure my code better but I don't know the language enough to do it.
...
4
votes
2answers
73 views
Compare files by name in two folders A and B and delete duplicates from folder A
I wrote my very first Python program to answer a Super User question. I'm wondering how the application can be rewritten to make it as pythonic as possible.
Unit test
...
1
vote
0answers
28 views
Tab completion for custom shell
The purpose of the code is to enable tab completion for a custom shell I'm writing. The target OSes are Linux and OpenBSD. I had to make a conditional include that I hope is correct:
...
10
votes
2answers
275 views
Identify files within folder structure that have common file sizes
The code takes in two arguments, a path to search and an output file name. It searches the supplied path (including sub directories) and writes out all files that have the same size as any other ...
3
votes
3answers
106 views
Removing numbering gaps in a series of filenames
I've recently started programming and have been working through some problems such as the one below:
Write a program that finds all files with a given prefix, such as spam001.txt, spam002.txt, and so ...
2
votes
2answers
64 views
Simulate the “cd” command of a file system
Write a function that provides change directory (cd) function for an abstract file system.
Notes:
Root path is '/'.
Path separator is '/'.
Parent directory is addressable as "..".
Directory names ...
3
votes
1answer
35 views
Create a new unique file
For debugging purposes I am storing requests into files. This code is supposed to create a new file for each request.
Somehow it doesn't look very nice, can it be improved? Additionally it would be ...
4
votes
2answers
71 views
Simple C# application that transfers new files (modified in the last 24 hours) from one directory to another
I'm new to C#, so I'm eager for any and all criticism/advice.
...
1
vote
1answer
31 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:...
-2
votes
1answer
52 views
What is better: join(dirname(__file__), '../../../testdata')) or join(dirname(__file__), '..', '..', '..', 'testdata'))
Both ways work:
os.path.join(os.path.dirname(__file__), '../../../testdata'))
or
...
1
vote
1answer
98 views
Move a folder to another in C#
In C# I wrote a method to move a folder into another existing folder:
...
4
votes
2answers
67 views
Importing JPG, JPEG, and PNG images from a folder to an Excel worksheet
As I am a novice, I was keen to solve the task, so now I want to optimize the code.
...
6
votes
1answer
125 views
UWP scan for music files
I am implementing a music player for Windows 10, and I am in a bit of a pickle at the library phase.
I am scanning for all the files in a music library (plus optional folders the user selects) and I ...
1
vote
1answer
16 views
Optionally creating a directory path based based on existence in NodeJS
I've been doing some reading and tutorials. As such I've contrived a node based project to apply what I've learned. I thought this was a good example as it had some conditional async calls and error ...
3
votes
3answers
106 views
Loading modifications at runtime
I'm working on a game engine among other things in Java, and would like to know how to optimise my code, as it is ridiculously ugly and bloated. I'm terrible with operating the ...
6
votes
2answers
87 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:
...
3
votes
1answer
40 views
Converting images to greyscale using JuicyPixel
I would like to use Haskell to do some image processing so I have been writing small programs to test performance. I wrote a program to batch convert PNG images from color to greyscale. I compared the ...
3
votes
3answers
45 views
Grouping filenames by basename and extension
I have created a function that parses a directory tree, and returns a list of lists that groups specific files within for later program specific parsing. I feel like it could be done better, ...
2
votes
1answer
23 views
5
votes
3answers
105 views
Simple file renamer in C
It's been some time since I wrote something in C. I am looking for some advices related to my code in terms of coding style, bad/wrong logic, optimization (performance) and good practices.
The code ...
1
vote
2answers
50 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 ...
1
vote
0answers
34 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, ...
2
votes
1answer
73 views
Create share folder, AD security group, add descriptions, and apply security to new folder
My goal for this script was to:
Create new folder
Create AD group FS-TESTSHARE-R
Create AD group FS-TESTSHARE-RW
Apply both groups to the new share folder
Set full read permissions to FS-TESTSHARE-R
...
3
votes
1answer
53 views
Uploading multiple files using a class
Below I have implemented a class that will validate and upload files based on the specified rules.
...
6
votes
1answer
73 views
Batch script to make folders hidden
I just wrote a simple script cmd to hide private folders by combining several scripts from the Internet. Can anyone give me suggestions for improvement?
This batch file uses a password hidden by ...
16
votes
1answer
142 views
From new Q to compiler in 30 seconds
Reviewing code doesn't necessarily require actually building it, but it's often helpful to do so in order to evaluate fully. I usually create a CMake project and ...
1
vote
2answers
82 views
Find a specific file, or find all executable files within the system path
I wrote a function to find a specific file, or all the executable files with a given name and accessing flag, and I want to make ...
7
votes
2answers
172 views
Exporting a UserForm from the VBE… and working around API bugs
Rubberduck has been using an extension method to export code files, notably for source control purposes.
While testing source control, I ran into a weird bug in the VBIDE API, which caused UserForm ...
1
vote
1answer
51 views
Removing folders from my rails app with rake
I'm trying to remove the tmp/letter_opener folder. Everything works fine, just wondering if there's a better way to write it. My next step is to write some tests, ...
5
votes
2answers
85 views
Copy files mentioned in an Excel sheet
Please help me in reducing the time complexity of this code as it is taking a long time to read its Excel input.
...
6
votes
2answers
168 views
Recursive directory copy program
A little while ago, I had to write a little C# application to recover my HDD data (full context on this question)
To answer my problem I developed a console application which job was to recursively ...
4
votes
2answers
92 views
Finding duplicates in given list of files
I implemented a simple tool to find duplicate files, by applying the following strategy:
Take a list of files and return the sets of duplicates (set of sets)
Implement a custom ...
0
votes
0answers
51 views
Resolving the path to a Bash script
I wrote a function to resolve the full path to the current Bash script, and I'm wondering if it's SOLID:
...
3
votes
1answer
368 views
Finding the latest file in a folder
I'm a bit new to Python and sort of learning on my own. I wrote a small function to help me find the latest file in a directory. Taking a step back, it reads a bit janky and I was curious what steps ...
1
vote
2answers
44 views
File presence check for an automated workflow
I am working on a script for an automated workflow. It expects a CSV and a disk image to be present in the directory that is supplied as args.input.
I want to check for and handle every possible ...
4
votes
1answer
44 views
Auto move files to a sub folder with Ruby
I started writing a script to handle my file downloads in osx because they quickly pile up and it gets time consuming to do this manually by drag and drop. I am looking forward to get some feedback.
<...
4
votes
2answers
96 views
2
votes
0answers
30 views
Frequency of words in all files of a directory using Future - Scala
I created a program to get frequency of word in all files in a directory using Future API
...
3
votes
1answer
73 views
File read/write methods
I'm using some simple files for caching and some basic user data. I was first just using file_put_contens and file_get_contents, ...
1
vote
1answer
51 views
Randomly choose a game executable from a folder 2.0
After asking Randomly choose a game executable from a folder, I applied the recommended changes. I also redesigned the program to make use of the MVVM (Model-View-Viewmodel) paradigm, using Prism 6.0. ...
2
votes
2answers
96 views
Bookshelf with Sorting, Categories and File I/O
I've been working on a project originally for school regarding object-oriented design, where I was supposed to write a class for a book and a bookshelf, and then have a driver class to add a couple ...
2
votes
1answer
61 views
List of Files in any Folder - Scala
I have written a code to count the number of files in a folder and if there are any folder inside folder it will count the files in that folder too.
...
2
votes
2answers
67 views
Applescript to change file extensions
I'm new at scripting, but I thought it would be handy to have a script that would change the extensions of selected files in Finder. I run this script from an automator service so that batch changing ...