Questions tagged [file-manipulation]
219 questions
1
vote
0 answers
What file manipulation commands work across all operating systems?
I'm making a python script that will perform various file manipulation functions. I need it to work across all operating systems so the commands I use can't be specific to any one operating system. I can't used any os commands, and can't use any…

lsch91
- 335
- 3
- 11
1
vote
4 answers
python to uncomment the right line
I have a file as follows:
line 1: _____
...
# for AAA
#export CONFIG = AAA_defconfig
# for BBB, BbB, Bbb, BBb3
#export CONFIG = BBB_defconfig
# for CCC, CcC, Ccc, Ccc1
#export CONFIG = CCC_defconfig
...
other lines
I want manipulate the…

pepero
- 7,095
- 7
- 41
- 72
1
vote
1 answer
how to efficiently work out where a file breaks from another earlier version?
I have a file that is constantly added to (a process beyond my control) and I capture that file every x seconds. I want to extract the new contents of the file (added between my previous capture) and work with it. The file unfortunately doesn't have…

sam
- 5,459
- 6
- 32
- 53
1
vote
2 answers
How can I over-write a string in a file using python?
So I have a text file (called 'Numbers') which looks like this:
1 - 2 - 3 - 8 - 5 - 6
1 - 2 - 3 - 4 - 5 - 6
1 - 2 - 3 - 4 - 5 - 6
1 - 2 - 3 - 4 - 5 - 6
I want to replace the number 8 in the first line with a number 4.
How do I do this?
So…

MiniMo
- 13
- 2
1
vote
2 answers
Copying specific files from multiple sub-directories into a single folder in R
Assuming I have 3 folders with a large number of files in each, I want to select only a few files from each sub-directory and paste only those files into a new folder.
Let's call the 3…

Geochem B
- 418
- 3
- 13
1
vote
1 answer
Batch Image Manipulation keeps hanging
I use the following code to scale and crop all images in a folder.
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(file);
string fileExtension = Path.GetExtension(file);
string filePath = Path.GetDirectoryName(file);
string…

Paul Zahra
- 9,522
- 8
- 54
- 76
1
vote
2 answers
Powershell Move file to new destination based on trimmed file name
I have a folder where files get dropped, I wish to pull the files from that folder and move to a new folder based on part of the file name. If the new folder is missing then create it.
I have attempted to put together the below, however it throws…

Lucas
- 43
- 2
- 10
1
vote
2 answers
List directories that begin with a pattern
I have a directory with thousands of sub-directories.
Each subdirectory begins with a URL name, for example: /australia.gov.au_about-australia
I want to get a list of all the sub-directories that begin with a certain string, e.g.…

timothyjgraham
- 1,142
- 1
- 15
- 28
1
vote
2 answers
Script for .SAT (ACIS) files manipulation
I need to make a script for ACIS files manipulation, for example:
I have 1 SAT file exported from a CAD software with a 3D Model, and i want to create a script in some language (php, python, etc.. even .BAT if it works) that opens the SAT file…

Pedro Vieira
- 15
- 7
1
vote
1 answer
Modifying and Comparing similarity of two files
I have 2 files. Sample values of file1 are as follows:
1313 0 60
1313 1 60
1314 0 60
1314 1 57
1315 1 60
1316 0 60
1316 1 57
1317 1 57
1318 1 57
1333 0 57
1333 1 57
1334 0 60
1334 1 60
Sample values of file2 are as follows:
813 0 91
813 1 91
814 0…

progammer
- 1,951
- 11
- 28
- 50
1
vote
1 answer
C++: Manipulate file resources?
Are there any WinAPI functions or so to manipulate file resources?
I'd like to replace menu scripts, icons etc of system files like shell32.dll and shell32.dll.mui using C++, but I really have no idea how to get started on this. :/
I know that…

Forivin
- 14,780
- 27
- 106
- 199
1
vote
1 answer
Java File manipulation
So I have an application with a JFileChooser from which I select a file to read. Then I change some words and write a new file. The problem that I am having is that when I write the new file it's saved in the project directory. How do I save it in…

user69514
- 26,935
- 59
- 154
- 188
1
vote
4 answers
Storing and loading program data, C# WPF
I'm writing a utility program with C# in WPF that allows users to create role-playing scenarios, including monsters, items, characters, etc.
The user will create or import the elements (monsters, etc) and then use the imported elements to create…

Joel
- 2,217
- 5
- 34
- 45
1
vote
3 answers
Fast way to add line/row number to text file
I have a file wich has about 12 millon lines, each line looks like this:
0701648016480002020000002030300000200907242058CRLF
What I'm trying to accomplish is adding a row numbers before the data, the numbers should have a fixed length.
The idea…

Alan Featherston
- 1,086
- 3
- 14
- 27
1
vote
2 answers
replacing fixed amount of text in a large file
I'm trying to replace a small amount of text on a specific line of a large log file (totaling ~40 mil lines):
sed -i '20000000s/.\{5\}$/zzzzz/' log_file
The purpose of this is to "mark" a line with an expected unique string, for later testing.
The…

Alex
- 10,470
- 8
- 40
- 62