Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading, and writing files.
0
votes
1answer
32 views
nodeJS, fs, path - creating new directorties
I wrote this function that takes 2 arguments - the path to an existing file - file, and the newRoot name. The function splits ...
4
votes
1answer
212 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 ...
2
votes
1answer
31 views
Securely Delete All Drive Data
When giving away or selling a PC, one should be careful not to send personal data with it. I'm in such a situation and was using dd if=/dev/urandom of=/dev/sdb bs=8M...
4
votes
4answers
154 views
Basic spellchecker with File I/O
This is a basic spell checking program that I wrote earlier today. It accomplishes the tasks that I had in mind, but was curious about improving my coding style and improving efficiency of my program. ...
5
votes
2answers
88 views
Short script to hash files in a directory
What improvements could be made to this script and can you explain why you would make those changes?
...
1
vote
0answers
37 views
Class for managing (file I/O) data
I want to make an attempt to write my own simple RPG. As a preparation for this task I created a class which I could use to store/retrieve my in-game objects data to/from disc. I chose JSON format as ...
3
votes
2answers
50 views
Building a summary string from a flags enum
I'm trying to replicate the attributes text that appears in File Explorer, for files and directories.
I can't just use the enum names, as the summary text uses a single character for each set flag, ...
4
votes
2answers
67 views
Random playlist builder is slow
I wrote a Python script to scan my music library, randomly select 50 songs, and play them in VLC media player. It works great, just a little slow (takes several seconds to launch).
I know that ...
8
votes
1answer
71 views
Ntree: a reimplementation of the tree utility
tree is described as "a recursive directory listing command that produces a depth indented listing of files" on the homepage for its Linux implementation. I don't ...
3
votes
3answers
133 views
Create and back up files
I have to develop a class that creates new files. If a file with the given name already exists, it should be renamed by addition of the timestamp to the file name. The file name should be human-...
8
votes
3answers
247 views
Removing multiple slashes from path
I have been trying to write a sample code block to remove multiple backward or forward slashes from a path (e.g. //a//b should be ...
5
votes
4answers
602 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:
...
3
votes
1answer
14 views
Merging directories and keep files that have more lines
Goal
My goal is to merge directories. Whenever a file has the same name in two or more directories, then only the one that has the highest number of lines should be kept. If both files have the same ...
3
votes
0answers
31 views
Recursively list files in provided directory in the style of `npm ls`
I've written a small CLI node program to list the contents of a directory with an output similar to that provided by npm ls but listing both files and directories, ...
1
vote
0answers
38 views
RSYNC Style Mirror Folder Application
I've written a mirror folder application in C#. It uses CommandLine for command line parsing. I'm just looking for a general review.
...
2
votes
2answers
35 views
Recursive Directory Searching For Filenames
Purpose:
Given a target folder, and a list of target sub-strings, determine if the folder (or any of its' sub-folders) has a filename which contains any of the target substrings.
N.B. This class ...
4
votes
2answers
259 views
Copying directories in Windows 10
I wrote a program to copy directories in Windows 10. I have tested copying a directory (696MB) in 3 different ways:
xcopy: time taken - 52 seconds
ctrl+c: time taken - 78 seconds
My program: time ...
5
votes
1answer
58 views
Wrapper class for the shell “dir” utility
I was inspired to throw this class together by an SO question and thought I'd subject it to some welcome criticism here.
The class is basically just a wrapper around the shell utility ...
5
votes
2answers
71 views
List files in dir
I'm making a program where I need to check if files in the directory are correct (46 files and all 11 chars).
I've got two methods to do it but I don't know which one is better.
Using ...
4
votes
1answer
61 views
Directory listing, sorting and filtering in F#
Here is my first try at F#. My only functional experience is from JS.
This program takes a path as an argument and presents the user with numbered subdirs in that path. The user then selects one of ...
2
votes
1answer
65 views
Filesystem search class in C#
Anyone can tell how to make this code faster?
This search takes too much time... 700 000 files for 15 minutes...
I will be grateful for each micro optimization!
Search Class:
...
4
votes
2answers
92 views
Getting NTFS permissions of all shared folders on the local machine
How can I improve the speed of the script?
...
4
votes
1answer
241 views
Find files with content matching regex
Today I wanted to find a program that I wrote a while ago. I knew that it contained a certain regex, but I couldn't for the life of me remember the file name I saved it under. I knew I could use ...
5
votes
2answers
121 views
2
votes
1answer
58 views
Copying files, renaming conflicts
I wrote a script to copy a file, but this file already exists in the target directory. So, first I need to rename the original file.
The script works, but a colleague did not want to use it because ...
0
votes
1answer
77 views
Finance manager
Somewhat experienced with JavaFX, but this is my first potentially large JavaFX project that I recently started and wanted some feedback on anything that could be done better or more efficiently thus ...
4
votes
1answer
100 views
A simple MP3 file arranger
I am creating a simple Mp3 Files Arranger the Project is on Github
Questions:
How can I optimize this app?
Am I violating any OOP principle?
Is it readable?
How can I make it better?
GUI.java
<...
12
votes
2answers
467 views
Regex Matching a Naming Convention
Program Purpose
So, I have a naming convention for certain folders.
I want to take in a folder name, and determine if it conforms to the convention.
Naming Convention
The convention (case ...
6
votes
1answer
58 views
Validating FileSystem Structure
I have a File System. It is *supposed* to be laid out / used / added to in certain ways.
This is a program to report on the *actual* state of the file system versus what it's supposed to be.
In ...
7
votes
3answers
255 views
Searching files in a directory for a string
I have the following static class that enumerates directories in a folder, then searches each file in the folder (it seems to only work with text files even thought I don't explicitly specify that) ...
3
votes
1answer
52 views
File shredder in x86 NASM Assembly
This is a file shredder utility that runs on Linux. It writes random bytes over the file contents, repeating this 48 times and calling sys_fsync after each pass to ...
9
votes
2answers
259 views
Get directory permissions for all directories in tree
I have made a program that given a directory, will get the permissions for that directory and all sub-directories. The output is stored in a string that can be easily written to .csv. Each permissions ...
3
votes
0answers
30 views
Concurrently identify duplicate files from size ordered list
Following on from my program to identify files that have common file sizes, I have developed an application that takes the output from that process and then compares each of the files that are the ...
5
votes
1answer
74 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
67 views
12
votes
6answers
721 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 ...
1
vote
0answers
44 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
133 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
2k 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
186 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 ...
2
votes
1answer
48 views
Movies wrapper script [closed]
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
98 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
39 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
332 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
193 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
201 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
58 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
115 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
57 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
63 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
...