Sometimes, while trying to edit a file, the editor says "cannot write to file because is taken by another process". So, is there a tool which takes an input a file name (with its path) and tells which process has taken it with write-only acces?  If not, what is the thecnical reason that cannot be answered?  I ask this because is so annoying that the message does not inform what is the damn process locking the file and cannot understand why the OS programmer didn't give that obvious vital information. Thanks!
47066
How can I find out which process is locking a file or folder in Windows?  For instance, when trying to delete a folder, Windows reports this:     The action can't be completed because the folder is open in another program   Happens the same with a file, but how do I find out what program or application is currently using it and preventing me from deleting the file or folder?
86143
How can I find all files I can not write to?  Would be good if it takes standard permissions and acls into account.  Is there an "easy" way or do I have to parse the permissions myself?
65234
I'm writing a script which will use the filename of running processes. However, I'm unable to determine the full executable name of some processes.  Initially, I decided to query the Name entry in /proc/PID/status (or the second field in /proc/PID/stat). However, according to the , that field is always truncated to 15 characters, but I need the full name to avoid conflict/confusion.  An answer of  suggests to use /proc/PID/cmdline, but there are problems too. Some programs (e.g. chromium, electron) do stupid/smart things to the value in /proc/PID/cmdline so I can't just split the data there by NULL and directly get the program name as suggested in the manpage - they fill in a lot of things to the original argv[0] field and separate them by space, and I don't think merely splitting by space is a good choice because the path/filename may contain spaces.  This is even more complicated when I find out that some scripts (e.g. python scripts) are in the form /usr/bin/python /path/to/script while some are in the form /path/to/script. Though this is much easier to deal with as long as I have that field (without jams as above) and manually check and split.  Any ideas how to get the full program name/filename? It doesn't matter if the name contains the full path or not because that can be easily dealt with (as far as I can see now).
22863
Want to copy the file name quickly in Windows. I always use rename, copy , but feel it is quite slow. Any better way?
38797
Given file path, how can I determine which process creates it (and/or reads/writes to it)?
20342
I have a bash script that makes a cURL request and writes the output to a file called resp.txt.  I need to create an exclusive lock so that I can write to that file and not worry about multiple users running the script and editing the text file at the same time. Here is the code that I expect to lock the file, perform the request, and write to the text file: ( flock -e 200 curl 'someurl' -H 'someHeader' &gt; resp.txt ) 200&gt;/home/user/ITS/resp.txt  Is this the correct way to go about this?  My actual script is a bit longer than this, but it seems to break when I add the flock syntax to the bash script. If someone could explain how these file descriptors work and let me know if I am locking the file correctly that would be awesome!
92432
I want to both read from and write to a file. This doesn't work.   static void Main(string[] args) {     StreamReader sr = new StreamReader(@"C:\words.txt");     StreamWriter sw = new StreamWriter(@"C:\words.txt"); }   How can I both read from and write to a file in C#?
25327
I know this is more of a general linux question but w/e. So when I enter a program like vim in the command prompt it displays all the text in the file and I can edit it etc. But I can't figure out how to close or save the file and get back to the command prompt without killing the process. Any help is appreciated.
397
I have a script that needs to do some stuff based on file creation &amp; modification dates but has to run on Linux &amp; Windows.  What's the best cross-platform way to get file creation &amp; modification date/times in Python?
108177
I have a small program that is installed in a custom folder in the program files, but when I tried to read or write to files that are needed to operate, the program raises an Access Denied Exeption. How can I elevte the program, with the user's permission of course.
1727
How do I get the list of open file handles by process id in C#?   I'm interested in digging down and getting the file names as well.   Looking for the programmatic equivalent of what process explorer does.   Most likely this will require interop.   Considering adding a bounty on this, the implementation is nasty complicated.
40922
Is there a way to copy the currently selected filename, including the path, to the clipboard? Ideally this would be through the right-click menu.  Some degree of flexibility would be useful, like the ability to copy just the filename, path+filename, filename minus extension, etc. This isn't essential, though, as long as it can copy the path+filename.  The solution must be compatible with Windows XP, Windows Vista and Windows 7.
11442
I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do these pass/failure/correctness checks in real time.  I assume it is possible to do this, but what are the gotcha's involved when using Java? If the reading catches up to the writing, will it just wait for more writes up until the file is closed, or will the read throw an exception at this point? If the latter, what do I do then?   My intuition is currently pushing me towards BufferedStreams. Is this the way to go?
109532
I'm always wondering: most GNU/Unix tools take options in the form "minus something", sometimes followed by an argument. What if you got a file named minus something?  $ ls -f $ rm -f $ ls -f $ mv -f abc mv: missing destination file operand after `abc' Try `mv --help' for more information. $ cat -f cat: invalid option -- 'f' Try `cat --help' for more information.   or  $ ls -ohello.c $ gcc -ohello -ohello.c gcc: fatal error: no input files compilation terminated.   This is just out of curiosity; I don't have a use case for this.
53573
Basically, I would like to check if I have rights to open the file before I actually try to open it; I do not want to use a try/catch for this check unless I have to. Is there a file access property I can check before hand?
105435
Sometimes we can't select the text to copy &amp; paste, such as dialog boxes.  Sometimes it's just not practical, such as 100 files inside a folder.  Is there any practical and simple way to capture those text from the system into a text file?  I'd wish to know both in OS X and Windows. Maybe it just can't be done today...
71532
After hitting ⌘-O, how can I navigate my folders and select a file to open using only my keyboard?   In particular, how can I get the focus into the folder list? (From there I can use arrows or start typing the first letters of the desired file/folder.)  In some programs I can rely on hitting TAB 5 times, but this isn't reliable and I figure there must be a better way.