Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading and writing files.

learn more… | top users | synonyms

4
votes
3answers
144 views

Dictionary load function using hash table

This loads a dictionary text file into memory to be used as part of a spell checker. It's part of a larger program, but I wanted general comments so I can clean it up further. ...
4
votes
1answer
33 views

Filewatcher compiler for watching different files

I'm trying to create a filewatcher program that can watch different files. The files might have subfiles that are being imported into the main file, which is being represented by the file object. I'm ...
4
votes
2answers
52 views

File handling script

This is my first bash script so I ask to you to say what you think. The script must check every directory and if it finds a pdf file in this directory: move all the pdf files to parent directory, ...
1
vote
1answer
27 views

Service class for Archiving and Mirroring Files and Directories

I am writing an application that either mirrors a file/directory into another location or creates a zip file "snap shot" of a file or directory and stores it in another location. The user is able to ...
0
votes
0answers
15 views

Getting a list of all fines in a local disk

I wanted to get a list of all files in a local disk like C:\, so I wrote the Python script below to check the performance: ...
3
votes
3answers
78 views

Looping over files in C++ and changing their names to store data into a single file

I have a lot of data in separate files generated from a simulation program. All data is clear and formatted via a single space to read in 4 columns. I can open and store data from each file one at a ...
5
votes
1answer
64 views

List files and download

The following code list all files in a folder and allows the user to download one of them. It is working but I think it could be done better. Is there a way to reduce the number of forms to only one ...
2
votes
1answer
109 views

Faster file lookup

I'm polling an ashx handler to check if a specific file is present and return true or false depending on it. ...
3
votes
1answer
58 views

Optimize way of reading and writing file in node.js

I want to read the content of file then want to make few updates to content and then write that content to another file. I have created the code with node.js as follows. ...
1
vote
1answer
83 views
1
vote
1answer
40 views

Search a file system for files that match a given pattern

My concerns with this code: Is there a more efficient way to find files by pattern in Python? Does os.walk() work in Windows? Is this code pythonic? Should ...
3
votes
4answers
77 views

How can I prettify blocks with more than 2 of each block?

Actually, I just have no ideas. How can I make breaklines to make it more readable? Can anyone suggest ways on improving this? ...
3
votes
0answers
38 views

Proof of concept and learning exercise for the 'ports and adapters' architecture

The script creates a simple app with a GUI containing a 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 ...
1
vote
1answer
51 views

A PowerShell script like one-way rsync but worse

This PowerShell script works a bit like a one-way rsync; it's good enough for my Surface RT needs, anyway. However, seeing as this is my first PS script, and I was ...
2
votes
1answer
24 views

Trash Filing System

This is a script (function) to be added to a bashrc. The purpose is to not actually remove files, but rather to send them to a trash folder for safe keeping. I was tired of deleting important files. ...
7
votes
3answers
114 views

“Scripting.FileSystemObject” Replacement module in VBA

I have found Scripting.FileSystemObject to be slow and unstable. Calling file_object.Name repeatedly has caused my code to crash excel on multiple instances. ...
1
vote
1answer
60 views

Optimizing Perl script which looks for world-writable files

A script which scans a local filesystem and writes to a file a list of world-writable files found on the filesystem. I ran it on a server with a couple terabytes of storage; not all of it used. In ...
1
vote
1answer
38 views

Batch file renamer

Please tell me how I can improve the structure of this simple tool (depends on MissingH): ...
7
votes
3answers
103 views

Shell Script Image Replication

I have a shell script which is being used on an embedded human machine interface (HMI). This script is used to copy a few files from a USB stick to a different place on the device, but with multiple ...
2
votes
1answer
42 views

Python script to find large folders

I wrote this script a few days ago to find all files which were taking up over a certain threshold of memory on the hard drive. A hard drive on one of my computers had just 6 GB left, so I needed to ...
1
vote
1answer
28 views

ThreadSafe IsoStorageManager

Continuation of the last thread. So, i wanted to add a thread-safety and i was considering AwaitableCriticalSection and Task+Mutex. Ended up with mutex: it can be a bit slower but it would allow ...
1
vote
1answer
62 views

Search a directory structure for tar files and report on their size

I have a complex directory structure on my web server that includes .tar files for download; I'm trying to create a report on the size distribution of these files (e.g. 10 are less than 1MB, two are ...
4
votes
1answer
265 views

Writing to file in a thread safe manner

I'm writing Stringbuilder to file asynchronously. This code takes control of a file, writes a stream to it and releases it. It deals with requests from asynchronous operations, which may come in at ...
4
votes
1answer
222 views

FileSystemWatcher firing multiple events

Like others (FileSystemWatcher Changed event is raised twice) I am facing the problem that events of filesystemwatcher are ...
2
votes
2answers
237 views

Program simulating dictionary using file handling

I have made a program in C++ simulating a dictionary with very basic functionality. I do not have much experience in file handling with C++. Also, I want it to run on Linux and Windows. It would be ...
4
votes
3answers
92 views

Clean way to get size of directory

I'm working on a Unix machine where I can't use more than vanilla Perl, and I'm using Perl5.8. This script exits with a 1 if the current directory size is smaller than 1 GB (the character after ...
3
votes
1answer
34 views

Return path to rubygems.rb

From the command line, I can easily find the path to rubygems.rb $ gem which rubygems /usr/lib/ruby/1.9.1/rubygems.rb and ...
3
votes
1answer
38 views

Perl file sorting script

This is my first ever real 100% self made perl script, I'd like to know how I can improve it. ...
4
votes
1answer
87 views

Installing Mods With Python (v 2.0)

My original code is here. I made some changes to it based on your suggestions, but then I lost my flash drive and had to redo it. I have a suspicion that my second version was better than this one, so ...
5
votes
1answer
113 views

Need reviews for impacts of dirty bug fix

I was having a hard time with bug logstash#665. Hope they will fix it some day, but sparc/solaris support is probably not on top of their priority list. For further reference, original error is: ...
4
votes
2answers
66 views

Packaging a single-file Python copy-tool

I'm currently working on a very simple one-file project: Lumix provides the possibility for the camera TZ41 (and others) to load GPS data and tourist information from a DVD to a SD-card so that you ...
7
votes
1answer
73 views

Making a FileHandler more OOP-friendly using SOLID

I have a class created for the sole purpose is to help handle files. The class holds a path (folder) that contains a single file at a time. Some extra properties to this class are: age of a file and ...
1
vote
0answers
47 views

Reliability of flock mutex (LOCK_EX|LOCK_NB)

I would like to test reliability of system flock in a multi-threaded and concurrent environment as some suggest that they are not reliable (in comments). Thus I ...
4
votes
1answer
102 views

Security: Scale and cache images

Specification A simple PHP script resizes images on-the-fly. The script is called by the web server's 404 handler to return a scaled version of the original. For example, if the original image is at: ...
9
votes
1answer
177 views

Allowing user space file-system to (kind-of) keep more than maximum number of files open

The linked code below is meant to be used in a user space file-system (fuse). Given that multiple processes may have multiple files opened on the file-system, the files on the specific user space ...
2
votes
1answer
352 views
4
votes
2answers
72 views

Proxy evasion browser in Python

This code works. It is designed to retrieve website data directly, parse it, and open it as normal. I will develop it further later. Right now I want to know if there is any way to improve efficiency, ...
13
votes
1answer
128 views

Regular backup/snapshots

A (long) while ago I set up a file server in my basement running Linux. I am OCD when it comes to backups. I set the server up with (remember, this was a while ago): disk for OS disk for 'valuable' ...
2
votes
1answer
40 views

Loop filling a set with logging

After watching Raymond Hettingers talk Transforming Code into Beautiful, Idiomatic Python I got back to a function I wrote. I'm not quite sure how to make it more pythonic but I think this might be a ...
6
votes
1answer
228 views

Byte by byte directory comparison ignoring folder structures and file name differences

I haven't been able to find an existing tool that does this, so I'm attempting to create one. If anyone knows of one that already exists, I'd appreciate a pointer to it. I plan on using this primarily ...
5
votes
1answer
236 views

Python script using distutils to copy files on a Mac

I have a Python script I have written to copy files to a mounted Windows SMB share on a Mac. ...
12
votes
1answer
112 views

Follow-up to tool for posting Code Review questions

Description This is a follow-up question to Tool for creating Code Review questions. Things that has changed include: Removed replacing four spaces with one tab, all tabs and all spaces in the ...
8
votes
2answers
377 views

Sorting a set of numbers in a file using Java BitSet

I have implemented a program to sort a file consisting of numbers. The program generates a different output file with all numbers sorted in it. I have implemented this program using BitSet. I wanted ...
3
votes
1answer
89 views

Collecting files from a particular directory

I'm writing an object oriented package, and one problem I am trying to solve is a class that will get all PHP files in a particular directory and instantiate the classes but not abstracts or interface ...
8
votes
3answers
159 views

Search for directories with a certain prefix that contain no files of a given type

These two functions search for directories with a certain prefix that contain no files of a given type. Does the code adhere to Ruby standards and conventions? Am I doing something the hard way or ...
5
votes
2answers
196 views

Optimize disk enumeration and file listing

I am writing C++ code to enumerate whole HDD and drive listing. However, it takes more than 15 minutes to complete the disk enumeration of all drives (HDD capacity 500GB) and compile the response in ...
4
votes
2answers
131 views

Shorten code that gathers files from directories

I have the following method in Ruby that appears to be just one line too long according to Ruby style guides. (Specifically: Rubocop tells me that my method has too many lines.) Granted, I'm only one ...
2
votes
3answers
208 views

Python script to touch files of a particular pattern in all folders of a given name

The intent of this script is to hunt down all "*/testResults/*.xml" files and touch them, so that our build system doesn't issue errors that the files are too old ...
0
votes
1answer
96 views

How to ensure file exists, and get the absolutePath? [closed]

I need to: create an object with the absolute path of a file ensure the file exists My approach is to create a new Path and call toFile to make sure it exists - ...