Questions tagged [file]

64563 questions
1

votes
1

answer
233

Views

The filename, directory name, or volume label syntax is incorrect - when trying to readfile in go lang

I want to read contents of text file. When I am passing the file name as string like this: stream, err = ioutil.ReadFile('sample.txt') its working. Its even working if do in this way: filename := 'sample.txt' stream, err = ioutil.ReadFile(filename) But when I get the value of filename from string a...
Varun Gupta
-2

votes
2

answer
23

Views

Incorrect data printing when working with stock data in file in C

I am currently working on a program which gets the quantity and the price of 5 products and writes them to a text file,printing the whole data in the form of a table and later printing one of the chosen prices.However,it writes only the last product's data to the printed table and the price of a cho...
Aisha
1

votes
3

answer
74

Views

python - Variable scope after using a 'with' statement

I didn't find the answer for this question on stackoverflow, so I thought it might be helpful to ask it, and have it here - I am declaring a new dictionary after I open a file, in the following way - with open('some_file.txt','r') as f: dict = json.loads(f.read()) #converts text to a dictionary my...
Viktor Karsakov
1

votes
2

answer
243

Views

Read rows form 100+ GB files fast in C# [duplicate]

This question already has an answer here: Read large txt file multithreaded? 6 answers Determine the number of lines within a text file 10 answers working on a project that will load 100+ GB text files and one of the processes is to count rows in the specified file. I have to do it the following w...
the Wongfon Semicolon
-2

votes
1

answer
22

Views

how to make an executable (exe or bat) in mac that would work in windows?

I have created a c# program in visual studios on mac. but i need to submit it with an executable file like batch or exe that would work in windows via command line. how do i create an exe or bat file? thanks
Aseem Malhotra
1

votes
2

answer
147

Views

Passing local variable to batch with returnStdout in jenkins pipeline

When i try to substitute date_append variable in batch command as shown below, its not retrieving the date exactly, instead it shows as Snapshot-${date_append}.onp where is the exact issue? stage('test') { steps { script { date_append= '${new Date().format('yyyyMMdd_hhmmss')}' echo '${date_append}'...
K-rwer
1

votes
2

answer
42

Views

Writing to a file inside if statement not working in Perl

I've looked around here a bit and found similar questions but not exactly. If there is one, I apologize and please point me to it. I have the following code. I'm trying to create a csv file of simply an ID pulled from a filename and the filename itself. This is the ENTIRE script. use strict; use war...
Reverend Bubbles
1

votes
2

answer
72

Views

Why doesn't my batch file work in Windows CE?

My script is not executing on Windows CE version 8. I am getting a file path from the user as input, appending the filename and attempting to 'start' it. But the @ echo off isn't considered and all commands are shown in the console when runing in the device. Also, none of the start commands nor the...
Kumaravel Rajan
1

votes
1

answer
63

Views

Take the items of a json file separately

Hey guys so I am trying to read a Json file and write a specific item of it in a list. But the json file is in single quotes so I get the error. simplejson.errors.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1) I tried to convert the json file from single...
Alex Rika
1

votes
2

answer
35

Views

How to check whether a file exists, outside a Makefile rule?

This is a pseudo code: if .gitignore exists GITIGNORE_PATH := .gitignore else GITIGNORE_PATH := ../.gitignore fi all: do_build... I tried to search this, but they always show how to do this inside rules, as in: $(UBIN)/%: @if [ -f '[email protected]' ]; then \ $(CC) $(CFLAGS) -o '[email protected]' $(OBJS) -L $(ORAHOME) $(ORAL...
user
1

votes
2

answer
55

Views

Count the number of newlines (both Unix and Windows)

I have a text file and want to write a batch file to verify that it only contains one line with a specific content without any newline at the end of said line. Comparing the content of the line is not difficult, as I can just read it into a variable and then compare it to what I expect. My problem i...
jotasi
1

votes
2

answer
29

Views

Is possible to validate file size and extension before upload at the same time?

I have succeeded in validating the file extension with jquery but when I tried to validate the file size, I have problem that my code is not working. I using newest jquery version. PROBLEM EXTENSION AND SIZE FILE VALIDATION CODE HERE : (function($) {$.fn.checkFileType = function(options) { var defau...
Hana Journey
0

votes
0

answer
22

Views

Splitting by comma doesn't work as expected

I Read some data from a text file, I am trying to iterate line by line and split by comma, and I ignore lines that starts with #, here is the text file content: #this is the simulation file for your exercise, please read it carefully. #every line that begins with a pound sign [now known as 'the' has...
Devy
0

votes
0

answer
10

Views

Making Batch Code friendly for Powershell

I am trying to make the batch file code below friendly for powershell but I am not sure what syntax to use to make it work. Please assume that the variables have already been set. ruby '%FolderOne%\script.rb %FolderOne%\framework_properties.txt 2>&1 | tee -a %FolderOne%\Logs\%LOG_NAME% ' I put...
My Display Name
0

votes
0

answer
7

Views

Read and store x strings after int in text file in C

First off, I'm a beginner in C and programming in general. What I want to do in this case is to read a small story from a text file, and store the int and string that I get from it (similar to sscanf()). Here is the content of the text file: 8 Those be rubies, fairy favours; 256 In those freckles...
novicekiddo5131
1

votes
2

answer
1.3k

Views

Collect metadata from file java [duplicate]

Possible Duplicate: Getting the last modified date of a file in Java Is there a way to get file metadata like 'date modified' in java?
London
0

votes
0

answer
7

Views

How can I read a file which will be upload from a form in .Net Core API?

I create a method in my .Net Core API which will upload a file. [HttpPost] public async Task ReadFile(IFormFile file) { return BadRequest(file); } I do a return BadRequest(file) in order to read what it send me on postman. The result is this : { 'contentDisposition': 'form-data; name=\'file\'; filen...
user10863293
0

votes
0

answer
5

Views

How to have a unique random number generated in a csv file every time without manual intervention?

I need to pass 10 digit alpha numeric random value (e.g. AUT******* where * denotes any random number) in a csv file. Contents of csv file: Code,Account1,Account2,Account3 AUT*******,ABC,DEF,GHI This csv file will be uploaded in to a web application every time to perform some operation. I need this...
Siva
1

votes
4

answer
4.4k

Views

how can I call batch command multiple times until success?

I have a batch file that calls various commands, some of which will occasionally fail due to network issues. Re-trying the command will usually result in success. How can I re-try the commands automatically, up to a set number of tries? Here is the some pseudo code that aims to explain further call:...
Craig
1

votes
3

answer
1.9k

Views

Sending a File is better or a Output Stream

In my project we are saving some files. When a file is requested, I fetch the file from the HBase table and then send it to the browser. Data is saved in Bytes in HBase. So when I fetch the file I am getting it in Bytes. Now I have to convert these Bytes into either File object or in Output Stream....
JHS
0

votes
2

answer
23

Views

In Python, how do I read an input file to then translate it to morse code?

I have to create a program that asks the user for an input file, and then creates an output file containing the message encoded in Morse code. When I run my program, there's a type error in the 'translated += alphabet[words]' line, it says it's an unhashable type: 'list'. How can I translate the tex...
user11407982
0

votes
1

answer
20

Views

iOS Swift, what is the url of the “on my iPhone” folder

I need to import to my app some document that have been saved into the 'On My iPhone' folder. What would be the url of this folder? (those document (pdf) are saved outside the app by the user and I would like if possible to move/copy them to the app document folder but again I can't find that url.
Julien7377
0

votes
0

answer
3

Views

Reading excel file throws a COMException

I am trying to read from an EXCEL file and display what i get. Here is my Excel Class. class Excel { private string path = ''; _Application excel = new _Excel.Application(); Workbook workbook; Worksheet worksheet; public Excel(string path, int sheet) { this.path = path; workbook = excel.Workbooks.Op...
learningsymfony
1

votes
1

answer
4.1k

Views

Java - Jackson to a file

I have a JSON file like this: { 'Product': { 'ID': '08-17-96-71-D9-68', 'Licences': { 'total': 40, 'used': 0, 'remain': 40 } } } I used jackson to convert it to a Java Object and I get all the values (so far, so good). My problem is that I want to change these values and re-write the JSON file but...
Alberto
0

votes
0

answer
23

Views

Parse String (stdobject) in file to stdobject

I'm trying to parse a stdobject written in a file to a stdobject that I can use to code with. These are lines in a file. stdClass Object ( [result] => [NumberDocument] => 3 [Error] => 1 [Errors] => stdClass Object ) ob_start(); include_once('file.txt'); $result = ob_get_contents(); ob_end_...
2

votes
0

answer
15

Views

How to delete a folder after calling FileUtils.saveAndUnzipToTempDir

I am using FileUtils.saveAndUnzipToTempDir for unzipping folder/files to a temp directory, and I want to delete that folder once I'm finished going through the folder. I don't have a great java experience, but I think that the saveAndUnzipToTempDir process is not finished yet, and don't know how to...
display_name
1

votes
2

answer
2.9k

Views

List filenames and folder paths on csv using batch file

I have a batch file that lists the full file directories (including filename at the end) onto a csv file. I need it to produce this, but also just the filename in a separate column. I would like it so that the format is Filename in first column (including extension) and full file directory in second...
user3361017
1

votes
2

answer
2.6k

Views

Not getting file type and tmp_name while uploading

I want to upload image and pdf same time but it is giving error. I don't know what I have missed, image is uploading properly but there is problem while uploading a pdf. Here is the piece of code. NAME : PDF : IMAGE : I am getting output as : Array ( [brwAddNewsPdf] => Array ( [name] => Newsletter...
Dinesh Patil
-1

votes
0

answer
19

Views

how to get the file path from root directory instead of workspace [on hold]

how to get the file path after uploading file from root directory instead of workspace. get absolute path/canonical path return the workspace path is there any way to get actual file path from root directory
Ansh Jain
0

votes
0

answer
6

Views

Validate uploaded file for jpg and png and save to static folder

I am using spring boot and I want to upload an image via a form. It works, but there are 2 problems: 1) I do not know how to validate the file to make sure it is either jpg or png 2) I can upload only to the root folder, not to the static folder, I do not know how to set the correct path to the reso...
jukenduit
0

votes
0

answer
5

Views

netsh - The syntax of the file, directory, or volume name is incorrect

I am actually trying to make a script to change my network whenever I want to. But the netsh command result in an error. FYI, my OS is set to French Language. Here is my code : SET NomConnexion=ReseauLocal SET IP=192.168.1.188 SET Masque=255.255.255.0 SET Passerelle=192.168.1.254 netsh interface IP...
P. Jerome
1

votes
0

answer
13

Views

AWS: Access Denied when trying to load presigned url (direct fileupload browser)

I'm attempting to use a presigned URL but I keep getting a 403 Forbidden Access Denied despite setting up everything as I believe that I'm supposed to. I want to upload a file directly from the browser to Amazon S3. I'm first of all enabling the root AWS account to use putObject. I don't have any a...
jones
1

votes
1

answer
1.7k

Views

File or directory _findfirst C++

I'm writing program which lists all files and subdirectories in particular directory and returns size occupied by directory. I use to this purpose functions _findfirst64 and _findnext64 How can I know if object is a file or directory?
user3219243
1

votes
3

answer
144

Views

Insert file into SQL field and extract back into file

I created simple table: SHOW DATABASES; CREATE DATABASE observe; USE observe; CREATE TABLE `see_me` (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT, name VARCHAR(20), food VARCHAR(30), confirmed CHAR(1), signup_date DATE, file_contents LONGBLOB // or VARBINARY(MAX) ); and a file called t.txt. How can...
Ursa Major
1

votes
1

answer
1.4k

Views

Timestamp in Batch File not Updating Properly

I'll start off by saying that I'm very new to scripting... I'm trying to create a batch file that periodically pings a host. At the moment, I'm just testing it on my local PC. Here's what I've got so far: @echo off set SERVERNAME=127.0.0.1 set limit=3 ECHO %date%, %time% Starting ping test to localh...
jakeythehobo
1

votes
2

answer
2.2k

Views

How to read a file byte by byte using BufferReader class in java

I want to read my file which is a large one byte by byte and i currently using this class for reading the file: public class File { public byte[] readingTheFile() throws IOException { FileReader in = new FileReader('/Users/user/Desktop/altiy.pdf'); BufferedReader br = new BufferedReader(in); String...
Barlet South
1

votes
2

answer
684

Views

Batch script to switch between two proxies

I'm using a batch script for my pc at work to switch between two proxy servers. Currently I have 2 separate scripts for each of the proxies which I use accordingly to which server I want to connect. reg add 'HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings' ^ /v ProxyServer /t REG_SZ...
sluz
1

votes
4

answer
2.5k

Views

How to use ELSE statement in .bat file that has multiple IF statements? [duplicate]

This question is an exact duplicate of: How to use an If Statement in .bat file to run one of Multiple options [duplicate] I'm writing a Windows batch file to enable, disable or make manual a Windows Service. How would you use an ELSE statement if you have multiple IF options? For example: if /I '%c...
Thelps
1

votes
1

answer
2.9k

Views

Monitor changes in files on Windows using .NET Core 2.0

Before you send me links to here, here and maybe here bear with me. I'd like to write a service that monitors changes of a given set of files and I started with the simplest thing writing console application that monitors directory in order to continue with my POC. However, I got stuck trying to ext...
kuskmen
1

votes
2

answer
464

Views

Where/how to replace default upload handler in Django CBV?

I am trying to specify a specific method of handling file uploads for a class based view. Per the docs this can be achieved by something like: from django.core.files.uploadhandler import TemporaryFileUploadHandler request.upload_handlers = [TemporaryFileUploadHandler(request=request)] If i specify t...
BartDur

View additional questions