Skip to content
Advertisement

Tag: file

Which system call does the Linux file command use?

Do you know which system call the Linux file command uses to determine the type of file? On the command line, if you use the file command it will reply with something like: dev-1:~/$ file download.png download.png: PNG image data, 724x 724, 8-bit/color RGBA, non-interlaced Is this an entire routine that does that? Or is there a system call that

Unable to lock file linux

I’m trying to lock a file and obviously there is something I’m missing, because eventhough it seems it’s locked I can still access and edit it using vim editor. Locking file: Checking using lslocks: But still able to access it and edit using different terminal (different process I believe). I tried the solution with file descriptors here Linux flock, how

How do I get the filename of an open std::fs::File in Rust?

I have an open std::fs::File, and I want to get it’s filename, e.g. as a PathBuf. How do I do that? The simple solution would be to just save the path used in the call to File::open. Unfortunately, this does not work for me. I am trying to write a program that reads log files, and the program that writes

Linux Command Line – list all directories containing .js files, and copy the directories and their contents to a new folder

Here is the code I already have that finds and lists all directories containing .js files (excluding the node_modules directory). As you can see, listing those directories is no problem. However, rather than list the directories, I would like to copy them (and their contents) to a new folder, preferably all in one line without running any kind of script.

Piping to File Utility

I am being sent the bytes of thousands files over an interface, and my app must maintain statistics regarding the counts of various files types which it observes (text, HTML, binary, compressed, etc.). I have been using the subprocess module to run the file utility. However, as the scale has increased, I am having performance issues due to the IO

How to read a variable from file, modify and safe it to an other variale

What I want: There is a file /scripts/backup/config.cfg which contains variables. In my specific case the important ones are: Then there is a script /scripts/backup/performBackup.sh For a specific reason I want a part of the script do the following operations: read the value of the variable ROOTLOCATION add a (“/” and) timestamp (Date&Time) safe the new created value to BACKUPLOCATION

Unix -Delete even bytes from a file

I want to find and delete all even bytes from a file given in command line. Is there any command for this situation? Answer I think this does what you want. It dumps the file as continuous plain hex, then reads two bytes, saving them for later and then two more bytes. Then it outputs the bytes it saved and

How to access Azure Linux web app path file

Trying to access file on path – wwwroot/templates/file.txt. It works using -_hostingEnvironment.ContentRootPath + “templatesfile.txt” on windows but same path says file does not exists. What Am I missing Answer Trying to access file on path – wwwroot/templates/file.txt. The following code snippet work for me, you can refer to it. And please make sure the file is really existing under that

Advertisement