Use this tag for reviews of code that performs file system operations, such as creating, deleting, renaming, moving, copying, reading and writing files.
4
votes
1answer
26 views
Rename files to all lowercase letters
I use this Bash script to rename specified files to all lowercase letters:
...
1
vote
0answers
24 views
Safely include requested pages without a whitelist
Is this pretty safe from breakout attempts? I'd rather not make a whitelist and check if the requested page is in the array since theres a ton of pages. And I wanna keep it clean. So I'm looking for a ...
2
votes
1answer
36 views
Counting the lines of a compressed file
This is a Python script for counting the lines of a compressed file:
...
2
votes
2answers
50 views
Handling thread interruptions in a directory iterator
This code is code written on a whim to help $someindividual asking for such a thing on $somechatmedium; what is needed is a way, ...
7
votes
1answer
79 views
Changing desktop background to the next available one
How could I improve this working Perl script, which changes my desktop background to the next available one, without opening a terminal? Specifically, how could I iterate over my .fehbg and walls/ ...
4
votes
1answer
38 views
Copying files in Haskell
I recently watched a video in which the speaker said that Haskell is not suited for real-world tasks, such as copying files from one folder to another.
So I tried to write a program that copies a ...
1
vote
2answers
68 views
Backing up an entire website with PHP
I'm attempting to backup lots of website using this php code. The script basically goes through the whole public_html directory and adds all the folders and files recursively and zips them.
Here's ...
4
votes
1answer
54 views
Ruby script to create git repos
I wrote my first ruby script, by this tutorial. It creates a local and remote git repo.
I have been working for about 3 years with PHP, and somehow I find that my ruby script looks incredibly ugly.
...
3
votes
1answer
44 views
File Exists Script Task for SQL Server SSIS
I have an SSIS package for SQL Server 2008. In this package, I need to verify that a file exists that matches a pattern of SomeFileName_*.txt where the wild card ...
2
votes
2answers
36 views
Merge all files in a directory with a specific extension
I come from Python, with a bit a FORTRAN and Matlab some years ago.
I'm trying to learn C. My first attempt at a program is one to merge all the files in a directory with a specified extension
...
-3
votes
2answers
92 views
Operating on files from source directory [closed]
I have a small program that does a fairly trivial task. I am unhappy about the fact that I have everything in Main or called from ...
3
votes
1answer
41 views
Unit testing a bash script manipulating the working directory path
bd is a bash script to conveniently jump multiple directory levels up from the current working directory instead of a tedious and possibly inaccurate ...
2
votes
1answer
48 views
Clear cache files older than 30 minutes
This is what I came up with to delete files not modified within the last 30 minutes from a subdirectory named cache.
...
8
votes
2answers
117 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 ...
4
votes
1answer
42 views
Glob-Like Search in VBA
The Dir() function in VB and VBA can accept wildcard characters (* and ?) but only in the basename of the path.
...
3
votes
2answers
112 views
Concatenating rows in CSV files and removing old CSV files
I have written my first Python script that will go into live use at my workplace. I am relatively new to Python and I think this script is pretty good but I would like your input.
It runs very fast, ...
2
votes
1answer
76 views
Should I add a function that takes as parameter a ptree?
I have a class ConfigFile that reads some values from a JSON using Boost and store them in variables. Everything is done in the constructor:
...
5
votes
4answers
225 views
Mounting multiple partitions on a disk
Is it possible to improve the code of this bash script? ... or should I just use another language? (If so, which one would fit the best the situation, according to you?)
Here is the code (simplified, ...
1
vote
2answers
51 views
Putting all desktop items into a new folder
I'm quite a newbie with Python, but I wanted to try my own little project, so I made a small script that puts all the desktop icons/folders into a newly created folder (called "Desktop1") if there are ...
0
votes
1answer
22 views
Searching for files across multiple code projects
I was tasked with conducting a large number of text searches in the code files of multiple projects. Initially, I just used the Find in Files feature of Visual Studio in a couple of the running ...
1
vote
0answers
41 views
Tree Utility in Python
I wrote this piece of code to mimic the *nix tree utility, however, I am not happy with the pad_info=[] part. It's used to make padding according to whether the ...
4
votes
1answer
79 views
Database and file backup script
I created a Backup class because I couldn't find one that worked well on Windows and remotely, to do this I have combined a lot of questions on stackoverflow with a lot of trial and error to get it to ...
5
votes
3answers
378 views
Splitting a path string
I have the following C# method to split a path string. The only thing I know is a fixed string in the path and I have to split the full path into two parts, first part should be one level below the ...
10
votes
2answers
320 views
Minimalistic rmdir
In my eyes most of the GNU stuff is bloated and doesn't really fit my view of how a Linux environment should look like. I have come up with my own minimalist implementation of the GNU Coreutils, but ...
-1
votes
2answers
159 views
A platform-independent implementation of “which” in Ruby
I like to know if there's anything that I may have missed in this implementation. The method tries to provide the absolute path of the binary or script which is likely to execute based on the provided ...
4
votes
0answers
42 views
Reading OS X file tags
I'm investigating Go for use in our internal network / office project management system, and need a way to check and edit the color tags that you can set in Finder on files or folders (extended ...
5
votes
2answers
169 views
Directory listing model
I need a class to read and store directory structure. This is my first step in Objective C so I ask to you to say what you think.
Header file:
...
-2
votes
1answer
26 views
Should I contain use a variable to avoid mentioning a filename twice? [closed]
for example i'm deleting file if it exist
if(file_exists('path/to/file')){
unlink('path/to/file');
}
or is it better to use
...
3
votes
2answers
111 views
Group and send all files to filetype folder
I have around ~2M of files in one folder, which I need to manage. So, I want to separate them in groups by their filetypes.
Example:
filenames
...
4
votes
1answer
61 views
Pathname matching and listing program
This Python 3 program outputs a list of all pathnames in the filesystem
that match a list of rules taken from a file. You can add and remove
sets of pathnames.
The original purpose was to generate ...
11
votes
3answers
166 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:
...
3
votes
2answers
200 views
Alternate method of iterating than os.walk
Recently, I became tired of how slowly os.walk seems to run (really, it should be called os.crawl), and made something recursive ...
2
votes
1answer
75 views
Parsing XML to send data into several files
My code works for the most part. (The problems are on the html side not the python side) however I feel it could run quicker or more efficiently. Due to the size of the XML document it parses it's ...
4
votes
3answers
410 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
52 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 ...
5
votes
2answers
82 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
63 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
39 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
145 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
74 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
120 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
161 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
101 views
1
vote
1answer
56 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
83 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?
...
4
votes
0answers
65 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
161 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 ...
7
votes
2answers
45 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
213 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
107 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 ...