Unless I'm misreading something, it looks like the temporary files created in AKAudioFile.appendedBy when the source file and appended file formats do not match (i.e. convertedFile and convertedAppendFile) are not being removed on return. The relevant methods are all defined in AKAudioFile+Processing.swift.
Related
I'm starting to go loopy on this one, which normally means I'm missing something obvious.
I have the following code in my .NET MVC controller:
var provider = new CustomMultipartFileStreamProvider("prefix", GetRepositoryTempFolder());
await request.Content.ReadAsMultipartAsync(provider);
The CustomMultipartFileStreamProvider inherits from MultipartFileStreamProvider, overrides the GetLocalFileName method and returns an appropriate file name for a given ContentDisposition header. The HttpContent handled is normally a PDF file and a small JSON settings component.
Everything works wonderfully as far as getting the parts parsed, extracted and saved in the expected location. However, after parsing I end up with a temporary file left over in my C:\Windows\Temp folder. The file has a randomly generated name (e.g. zf0hk2h4.ks2). It has the same size and creation date as the PDF portion parsed and saved by ReadAsMultipartAsync.
I believe ReadAsMultipartAsync uses this temporary file during parsing and leaves it behind. Has anyone else experienced this? Any way I can prevent ReadAsMultipartAsync from leaving this temporary file behind and clogging up the Windows temp folder?
My apologies; I was missing something. The file was being moved after processing. This is an invalid question; there is nothing wrong with ReadAsMultipartAsync.
How do we get the file full path in response when we use method sftp.dir.entries?
I want the file content of a directory(recursive). I have used sftp.dir.entries method to list the files present. How should I get the contents?
Perhaps you are looking for the glob method:
Works as ::Dir.glob, matching (possibly recursively) all directory entries under path against pattern. If a block is given, matches will be yielded to the block as they are found; otherwise, they will be returned in an array when the method finishes.
Because working over an SFTP connection is always going to be slower than working purely locally, don't expect this method to perform with the same level of alacrity that ::Dir.glob does; it will work best for shallow directory hierarchies with relatively few directories, though it should be able to handle modest numbers of files in each directory.
So, for instance (also taken from the documentation):
sftp.dir.glob("/remote/path", "**/*.rb")
should return all the *.rb files in any directory level on the remote machine. To get all files, use "**/*" instead. See also the Dir class' glob method.
I am looking for the Flume "Spooling Directory Source" recursive-look for the the files within subdirectories.
There are some references here https://issues.apache.org/jira/browse/FLUME-1899
however since then multiple versions have come out, is there any way we can have recursive directory lookup within subdirectories for the files in Spooling Source.
I think you can use the patch FLUME-1899-2.patch directly.
set the "recursiveDirectorySearch" as ture in your config file.
NOTE: the regex in ignorePattern of config file will also affect the recursiveDirectory folder name. so you might need to modify the code in org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java if you want to ignore the folder name.
I'd like to get a file last modified time in Delphi.
Normally something like FileAge() would do the trick, only the problem is: if I overwrite *File A* with File B using CopyFile, File A's modified date is not updated with current overwrite time as it should(?)
I get that: CopyFile also copy file attributes, but I really need to get the modified date that also works when a file is overwritten.
Is there such function? My whole application relies on modification time to decide whether or not I should proceed with files!
EDIT Just to clarify: I'm only monitoring the files. It's not my application who's modifying them.
The documentation for CopyFile says:
File attributes for the existing file are copied to the new file.
Which means that you cannot use base your program on the last modified attribute of the file, or indeed any attribute of the file. Indeed there are all sorts of ways for the last modified attribute of the file to change. It can in fact go backwards in time.
Instead I suggest that you use ReadDirectoryChangesW to keep track of modifications. That will allow you to receive notifications whenever a file is modified. You can write your program in an event based manner based on the ReadDirectoryChangesW API.
If you can't use ReadDirectoryChangesW and the file attributes, then you'll have to base your decisions on the contents of the file.
I have a zip file named test.zip which contains a directory named invoice. Inside the invoice directory there are documents each with different names. I would like to find a specific document named summary.txt which is inside the invoice directory.
I am able to get a handle to test.zip using the following:
zip = Zip::ZipFile.open("/path/to/test.zip")
but when I use
zip.find_entry("summary.txt")
I get nil.
On the other hand, if summary.txt is not inside the the invoices directory, but rather at the root of the zip file itself, the find_entry method as described above seems to work.
It seems that somehow I must navigate down into the invoices directory before searching for summary.txt.
Is this correct? If so, how do I do it? If not, what I am I doing wrong.
You need to specify the full path to the file:
zip.find_entry 'invoices/summary.txt'