Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading, and writing files.
3
votes
2answers
46 views
Analyze very large sets of engineering data from Excel files
I am an electrical power engineer with some programing skills. My boss asked me to make a program which could analyze very large data, make some calculations and give the result.
The task lookes like ...
2
votes
1answer
41 views
Hide/un-hide directory and open directory based on argument
This code checks to make sure a directory is hidden and if not hides it. Then if hidden it will prompt for password and if password matches it will un-hide it. There is also an argument to open ...
6
votes
2answers
95 views
Reverse engineering Darkstone game archives
Reverse engineering old games is something I do every now and then. This time, I took a shot at this old RPG called Darkstone.
The bulk of the game's data is stored in archive files with the ...
4
votes
1answer
39 views
Adding/changing ID3 tags to media files with “artist - title” format
This code puts or changes ID3 tags to media files based on their file names. It assumes the files are in this format:
morbid angel - maze of torment.mp3
The ...
3
votes
1answer
45 views
Loading files or directories based on type
I am building a config class for PHP which initially loads all given config files. To add files, users should be able to provide either a single file or a directory where files can be JSON or PHP.
...
3
votes
0answers
36 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 ...
5
votes
1answer
63 views
Matching between files and a list of filenames at scale
Given a folder typically containing ~250,000 small (20-100kb) files in HTML format (they open as single-sheet workbooks in Excel) and a list of ~ 1 million filenames, I need to open all the files that ...
4
votes
1answer
39 views
A rename utility in Scala
I made a commandline tool for renaming files, similar to the rename command in Ubuntu. Here is the code:
...
4
votes
1answer
78 views
File deletion takes a long time to delete files
I have a script I need to "duplicate" and modify to allow it to delete certain images based on properties I give this app/script. Currently the script just moves/sorts the images into folders based on ...
10
votes
1answer
209 views
A minimal version control system
I just finished writing a simple version control. You register files using "add", and then "com" will save them inside a directory, with an ID attached to it, same ID for all files. With "rev" it will ...
4
votes
1answer
42 views
Deleting most recent files by parsing filename
I have hundreds of .mp3 files in a single directory of the same naming format, title_YYYY-MM-DD.mp3, with maybe 30 different ...
4
votes
2answers
68 views
Who needs clean configuration? Swapping server.xml
So I'm working on a project that sometimes requires me to switch my server configuration. This is due to some circumstances with database drivers and names that are "too expensive to fix" ...
That ...
0
votes
1answer
28 views
File existence promise
I hate to have to write a custom exists promise every time I need to know if a file exists, so I came up with this. Thoughts?
...
7
votes
2answers
119 views
Backup Linux system to web
First I create a .tar of the root directory with all the file permissions saved and excluding all irrelevant directories (are these the right folders to be ...
1
vote
1answer
21 views
Transforming markdown files in folders into a documentation
I start coding a simple application: I transform markdown files in folders into documentation.
My architecture is very flat. My code looks like a series of unit function called one after the other.
...
1
vote
0answers
33 views
Making all directories to a path
Below are two promises: the first does a bit of nesting and the second is all anon then calls that return one function in them. Which do you prefer? Any improvements?
Promise A:
...
0
votes
0answers
14 views
Chain-able promise file system functions
I'm trying to invent an easier way of working with the file system. Here I chain promise methods together.
...
3
votes
1answer
37 views
Mapping file data to environment variables
This is a follow-on to my previous question: Enforcing set environment variables
While learning more about JavaScript, node, and the bluemix environment, I have been using the loading of process ...
7
votes
2answers
146 views
Enforcing set environment variables
Context
I have a node.js application that uses many other modules and libraries. Some of these modules pull details from process environment variables, such as URL's for databases, credentials, and ...
4
votes
0answers
42 views
In-memory file system context for the behat PHP BDD testing framework
I wanted to come up with a 'utility' context to enable testing of the file system with behat. Specifically this is aimed at helping with the behavioral testing of php command line applications that ...
7
votes
3answers
309 views
Reading and writing to file
Is there anything I can improve in my UserManager class which saves and loads info about users connected to my server?
...
5
votes
0answers
47 views
Mapping a file system to a tree structure
I need to write a very basic file/directory browser. The data structure I'm using is pretty simple - a Node with an optional parent and children. Along with the data structure I also need a simple ...
5
votes
2answers
77 views
Identifying most recent blogXX.php file
I create blog posts as blog1.php...blog20.php...blog500.php etc and redirect users from ...
8
votes
2answers
92 views
Fine tuning of an informative replacement for rm
I want to replace rm by a more informative variant: I would like to see which files will be deleted, along with their size, and I would like this information to use ...
2
votes
1answer
81 views
Program simulating dictionary using file handling - part 2
This is the new version of the dictionary program which I uploaded for reviewing here.
I would be grateful if the program could be reviewed for all the points mentioned in the above link.
...
6
votes
3answers
161 views
Synchronize multiple folders
I've been writing a program to synchronize two or more folders. I've read that methods should be kept short. While most of mine are, one method is ~50 lines:
...
4
votes
3answers
68 views
Fetching filesystem directory listings on a server
I developed a server which takes a directory name then lists files in it and sends this list to a client. And I want that server to work with Telnet.
It works but I have some questions on how I can ...
2
votes
2answers
48 views
Checking directory for processing
This checks whether it's valid to make a processing. Processing can occur if:
there are files and spreadsheets (spreadsheet is the spec attribute)
there are any files or spreadsheets (it never ...
4
votes
3answers
202 views
Find and remove duplicate files in one or more directories
I needed this to clean up a couple of similar music libraries, which also contained some empty files and duplicate files with different names.
...
3
votes
1answer
66 views
6
votes
2answers
201 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 ...
9
votes
3answers
141 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 ...
2
votes
1answer
276 views
Extracting ZIP, JAR and EPUB files
I wrote a utility class that is used to extract the contents of a ZIP file to a destination folder. This is a very small class, but it has several practical applications: it can not only be used to ...
1
vote
1answer
37 views
Alert on partition growth [closed]
I have a script that alerts me via email when a partition grows past a defined threshold in one hour. My script is run from cron hourly. Everything seems fine for 99% of the time, but occasionally I ...
2
votes
1answer
324 views
Delete folder if it exists in PowerShell
In my PowerShell script I'm trying to delete a folder, but only if it exists:
if (Test-Path $folder) { Remove-Item $folder -Recurse; }
I find myself repeating ...
3
votes
1answer
53 views
Recursively delete empty folders in Lua
I have written a script that run in WingFTP Server which has a Lua scripting engine built in. The script recursively deletes empty folders except the specified root folder.
...
2
votes
2answers
121 views
A “safe” copy function for Python
I have a Python script for doing "safe" file copying.
There are a couple of rules for this copy function:
Existing files should never be overwritten. So if I try to copy ...
3
votes
2answers
39 views
Search utility that searches through source code files
I'm working on a search utility that searches through source files. It's only the beginning of the project. It lacks a lot of features, but a backbone of the project works and it would be great if you ...
2
votes
1answer
48 views
Powershell photo sorter/mover
I'm just beginning in Powershell - This will be my first full project, start to finish, and it's quite small. I have already had experience in C#, which helps in this .Net based language.
This ...
6
votes
4answers
554 views
Get list of files in directory with exclude option
This method returns the list of files (absolute path) in a folder (or tree). It allows filtering by extensions or filenames.
The method receives the following parameters:
...
1
vote
1answer
26 views
Rebuilding WAR files in webapps directory
This script cleans up destination directory and copies file into it with new name. Can this intent be expressed more cleanly with shelly?
...
1
vote
2answers
307 views
Replacing thrown exception with more descriptive exception during file I/O
My code needs to open a specific file. Under certain (expected, but rare) conditions, the code will get handed a file path to a file that does not exist -- the path is expected to be otherwise valid ...
4
votes
1answer
153 views
Save File Manager
I made a class to manage saved file in drive with Swift, and I tried to do the best work.
Can someone get me a feedback about this class? What can I improve? Is this a good way to save a file?
...
3
votes
0answers
76 views
MD5 hash comparison for two folders
Using this page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if ...
4
votes
2answers
46 views
Simple Ruby directory navigator functions
In the process of writing scripts to work with CSVs and other files of the like I found myself in the need of a way to navigate and select files for various purposes. I wrote the following function ...
3
votes
2answers
122 views
4
votes
1answer
98 views
Move and rename images into separate folders
Basically, we came up with this task at work. I was wondering if there's a shorter and cleaner way of doing the following in some other language (or even improving what I did with Ruby).
We have a ...
4
votes
3answers
137 views
Directory Snapshot
The following code creates a recursive backup of a directory in the form of interlinked HTML files, structured in the same form as the input directory.
It does not take the backup of the contents ...
5
votes
1answer
136 views
Replicating a file system
The goal of this is just to practice. I went off on a self-challenge to replicate something(So the names of the parts can be ignored), I'm not done yet (Though what is here is fully runnable), but ...
4
votes
2answers
116 views
Text files: Copy, Rename, Append/Merge together
I wrote 3 subroutines related to batch data processing, they will be used together. A bit of background, I wrote this for my admin colleagues who do not write code. An application dumps daily ...