If you scan a folder containing other folders AND files, how do you get rid of . and .. and files? How do you put in array only folders WITHOUT . and ..?
I would like to use regular expression, but I'm newbie and I can't get it right.
My code is now this but doesn't work:
if(fnmatch("\.{1,2}",$dir_array[$i]) || is_file($dir_array[$i]...
How can I recursively delete all files & directories that match a certain pattern? e.g. remove all the ".svn" directories and the files they contain?
(Sadly DOS only)
...
Can you make file copying faster through multiple threading?
Edit: To clarify, suppose you were implementing CopyFile(src, tgt). It seems logical that under certain circumstances you could use multiple threads to make it go faster.
Edit Some more thoughts:
Naturally, it depends on the HW/storage in question.
If you're copying from on...
Hello all,
I am downloading a file from another server. I wish to push this file to my users rather than saving it to my server.
In other words, pass them the file handle so it just passes through my server and saves to their machine. How can I do this? I have this so far:
$handle = fopen($_GET['fileURL'], 'r');
$filename = stream_ge...
I have a server written in C# that makes use of impersonation.
I would like to know how I can change the security attributes of a file so that any user can delete it.
My server impersonates a user and then creates a temporary file. Later on I need to delete the file but at that point, I am no longer impersonating the user that created ...
I've large number of small files with sequential filenames & i want to create a single file out of it. What is the fastest way to do this?
e.g.
1.tgz.1 1.tgz.2 1.tgz.3 =========> 1.tgz
...
Hello all,
I am allowing users to download a file from another server just by giving them the link.
However, the files are always named "file.zip" when users try to download it. I was hoping I could use maybe JavaScript to rename the file for them to something more appropriate.
How can I do this? Is this possible?
Would appreciate a...
This earlier SO question talks about how to retrieve all files in a directory tree that match one of multiple extensions.
eg. Retrieve all files within C:\ and all subdirectories, matching *.log, *.txt, *.dat.
The accepted answer was this:
var files = Directory.GetFiles("C:\\path", "*.*", SearchOption.AllDirectories)
.Wh...
I have asked this question today already but this time I want to know if I can achieve this via PHP since Javascript wasn't up to it.
I have a link to a file on another server. If i provide this link to my users the headers are pushed out to download that file from that server.
Is there a way for me to capture those headers and file an...
What's the easiest/best way to find and remove empty (zero-byte) files using only tools native to Mac OS X?
...
I'm doing a small project in C after quite a long time away from it. These happen to include some file handling. I noticed in various documentation that there are functions which return FILE * handles and others which return (small integer) descriptors. Both sets of functions offer the same basic services I need so it really does not mat...
Language used: C#
Theory:
I want to create a file with the flag FileOptions.DeleteOnClose in a temporary folder.
The file is successfully created and I write dato onto it, the next step is to launch the application associated with the file Process.Start(...) and allow the user to inspect the document, finally I close my handle and as so...
Hello all,
I can download remote files using PHP but how do you download from a link that pushes headers out? I mean, you can click on some links and it will force a download and present you with dialog box to save the file. How can I download and save this sort of thing using PHP?
Any examples or links to tutorials would be great sinc...
I have an file input tag in my web app. I'd like to check that the file isn't too big before sending it to the server. Of course, I still have validation server side. Is there any way to do this with JavaScript? It must work in IE7+ and FF3+. Thank you.
EDIT: somefileinputobject.files[0].filesize works in FF, but not IE.
...
I have a very large column-delimited file coming out of a database report in something like this:
field1,field2,field3,metricA,value1
field1,field2,field3,metricB,value2
I want the new file to have combine lines like this so it would look something like this:
field1,field2,field3,value1,value2
I'm able to do this using a hash. In t...
I would like to know which pattern can I use in sed to make changes in the first line of huge files (~2 GB). The preference for sed is only because I assume it must be faster than a Python or Perl script.
The files have the following structure:
field 1, field 2, ... field n
data
and, given the likelihood of having spaces in the ident...
how can I delete all files and sub directories from current directory including current directory?
...
I'm wondering what techniques and/or library to use to implement the functionality of the linux command "tail -f ". I'm essentially looking for a drop in add-on/replacement for java.io.FileReader. Client code could look something like this:
TailFileReader lft = new TailFileReader("application.log");
BufferedReader br = new BufferedRea...
-What is the most foolproof way of ensuring the folder or file I want to manipulate is accessible (not read-only)?
-I know I can use ACL to add/set entries (make the file/folder non-readonly), but how would I know if I need to use security permissions to ensure file access? Or can I just add this in as an extra measure and handle the ex...
Seems like it should a really easy topic, all the examples everywhere are just a couple of lines however no decent explainations, and thus I keep running into the same error without a solution.
In short this part of the applicaion runs like so
Pulls images from db
Creates actual images files in a temp folder
creates pdf with images i...