in Education by
I have millions of file in a Folder its difficult to read with script so i need to store file in separate folder. just like Move File to A-D and E-G and H-L and M-P and Q-T and U-W and X-Z with there starting character.. I try to use FTP but million so file did not show in directory correctly (took very long time to display and for moving, some time FTP stuck), also try cpanel etc. but no luck. if there is a solution with PHP script please let me know, its help me alot. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Well, you could use DirectoryIterator and move the files based on the filename. I'd still rather recommend a more direct approach with SSH or similar (there are things PHP wasn't meant to do - like non-website things); this approach is Remote Client --request--> Web Server --access--> File System. Other than that, something like $dirname = dirname(__FILE__); $iterator = new DirectoryIterator($dirname); foreach ($iterator as $fileinfo) { if ($fileinfo->isFile() && $fileinfo->isWritable()) { $fname = $fileinfo->getFilename(); rename($dirname. DIRECTORY_SEPARATOR .$fname, $dirname. DIRECTORY_SEPARATOR .ucfirst(substr($fname, 0, 1)). DIRECTORY_SEPARATOR .$fname); } } Should move the files into a subdirectory with the same letter as the first character in the filename. If you want to move based on category groups of characters, just put the rename() call into a switch statement.

Related questions

0 votes
    If in a binomial distribution `n=4, P(X=0)=(16)/(81), t h e n P(X=4)` equals `1/(16)` b. `1/(81)` c. `1/( ... . `(1)/(27)` D. `(1)/(8)` Select the correct answer from above options...
asked Nov 16, 2021 in Education by JackTerrance
0 votes
    write a program to evaluate the arithmetic statement. X=A-B+C*(D*E-F)/G+H*K a) Using a general ... zero -address operation instruction. Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    Find the gradient of t = x^2y+ e^z at the point p(1,5,-2) (a) i + ... ,electromagnetic theory proposed by,electromagnetic theory engineering physics,electromagnetic theory nptel...
asked Nov 11, 2021 in Education by JackTerrance
0 votes
    Find the current density on the conductor surface when a magnetic field H = 3cos x i + zcos ... proposed by,electromagnetic theory engineering physics,electromagnetic theory nptel...
asked Nov 11, 2021 in Education by JackTerrance
0 votes
    Q.32 :-What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile? ... y); return 0; Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    i think my buddies have forgotten me?? ◑﹏◐ ಥ_ಥ if u are f r e e then l i k e my answer #what is full form of html Select the correct answer from above options...
asked Dec 22, 2021 in Education by JackTerrance
0 votes
    Why ∧ ∘ m for weak electrolyte (e.g.,NH4OH or CH3COOH) cannot be determined experimentally ? Select the correct answer from above options...
asked Jan 4, 2022 in Education by JackTerrance
0 votes
    List the human rights enumerated in the U.D.H.R. Please answer the above question....
asked Aug 3, 2022 in Education by JackTerrance
0 votes
    In Example 94, if n is even and E denotes the event of choosing even numbered urn (p(Ui)= 1 n ) , then the value of ... n n+1 D. 1 n+1 Select the correct answer from above options...
asked Nov 16, 2021 in Education by JackTerrance
0 votes
    For a unit step signal u (t), the response is V1 (t) = (1-e^-3t) for t>0. If a signal 3u ... theory Questions for GATE EC Exam, Network Theory MCQ (Multiple Choice Questions)...
asked Oct 17, 2021 in Education by JackTerrance
...