dir

Excel vba reading large amount of files faster

我只是一个虾纸丫 提交于 2019-12-01 23:08:33
I have vritten a code that finds all files starting with specific name and reads data from them, there is usually 1k files or more in the folder, i wrote a little benchmark and realize that my code reads aprox 1 file per second and that is a lot of time. I am prety new to vba, and i was wondering if i took a wrong aproach to this ? Function Code: Function ReadDataFromWorksheet() Dim XL As Excel.Application Dim WBK As Excel.Workbook Dim i As Integer i = 1 Set XL = CreateObject("Excel.Application") Do While i < (ArraySize + 1) Set WBK = XL.Workbooks.Open("PATH TO FILE") Array(i).Data1 = WBK

Matlab dir() takes forever to run

点点圈 提交于 2019-12-01 23:00:59
问题 I'm using the command "dir" on a directory with 500,000 files. It's been running for 15 minutes now. Is there any way to speed it up? an alternative command perhaps? Thanks in advance, Gil. 回答1: If you just want file names, try files = ls; . As per the help, I believe ls should work on any OS. The reason dir takes so long in your case is that it's calculating the file size, modification date, etc. of each file. 回答2: I know this is an old post, but... I'd like to point out that if you decide

Matlab dir() takes forever to run

Deadly 提交于 2019-12-01 20:46:26
I'm using the command "dir" on a directory with 500,000 files. It's been running for 15 minutes now. Is there any way to speed it up? an alternative command perhaps? Thanks in advance, Gil. If you just want file names, try files = ls; . As per the help, I believe ls should work on any OS. The reason dir takes so long in your case is that it's calculating the file size, modification date, etc. of each file. I know this is an old post, but... I'd like to point out that if you decide to use the "ls" function (as opposed to "dir") this behaves slightly differently in Unix and Windows operating

PHP recursive delete function

有些话、适合烂在心里 提交于 2019-12-01 18:03:35
I wrote recursive PHP function for folder deletion. I wonder, how do I modify this function to delete all files and folders in webhosting, excluding given array of files and folder names (for ex. cgi-bin, .htaccess)? BTW to use this function to totally remove a directory calling like this recursive_remove_directory('path/to/directory/to/delete'); to use this function to empty a directory calling like this: recursive_remove_directory('path/to/full_directory',TRUE); Now the function is function recursive_remove_directory($directory, $empty=FALSE) { // if the path has a slash at the end we remove

using quotes in sas macro filename pipe

╄→尐↘猪︶ㄣ 提交于 2019-12-01 12:22:10
问题 I am using the following Macro that uses filename pipe. But get an error saying invalid option name "dir", etc. I suspect it could be due to the quotes while defining filename and pipe. I guess it recognizes it as an option. I tried to remove the quote, removing %bquote and having just the double quote, but still keep getting the errors. I am using Windows, but will also be running it remotely on Linux. Any thoughts would be deeply appreciated. %macro setprogvar(dateval); %global date; %let

PHP Get dimensions of images in dir

余生颓废 提交于 2019-12-01 09:31:26
I have a huge ammount of photos that need sorting through. I need to know the dimensions of each photo in order to know or it needs re-sizing. As a programmer I'm convinced there must be a quicker way of doing this. I got quite far. The following code reads the dir and all the sub dirs. But the moment I try to extract the dimensions the loop halts at 8% of all the pictures that need checking. Could it be PHP is not allowed to do more calculations? What is going on!? This is how far I got: checkDir('dir2Check'); function checkDir($dir, $level = 0) { if ($handle = opendir($dir)) { while (false !

How to skip a directory in awk?

谁说我不能喝 提交于 2019-12-01 04:47:50
Say I have the following structure of files and directories: $ tree . ├── a ├── b └── dir └── c 1 directory, 3 files That is, two files a and b together with a dir dir , where another file c stands. I want to process all the files with awk ( GNU Awk 4.1.1 , exactly), so I do something like this: $ gawk '{print FILENAME; nextfile}' * */* a b awk: cmd. line:1: warning: command line argument `dir' is a directory: skipped dir/c All is fine but the * also expands to the directory dir and awk tries to process it. So I wonder: is there any native way awk can check if the given element is a file or

How to skip a directory in awk?

我与影子孤独终老i 提交于 2019-12-01 03:06:20
问题 Say I have the following structure of files and directories: $ tree . ├── a ├── b └── dir └── c 1 directory, 3 files That is, two files a and b together with a dir dir , where another file c stands. I want to process all the files with awk ( GNU Awk 4.1.1 , exactly), so I do something like this: $ gawk '{print FILENAME; nextfile}' * */* a b awk: cmd. line:1: warning: command line argument `dir' is a directory: skipped dir/c All is fine but the * also expands to the directory dir and awk tries

walking along and processing files in directory in python

允我心安 提交于 2019-12-01 01:02:45
I have huge data in a directory tree format like: c:/user/name/class/std/section I to VI [all section has individual folder i.e. 6 folder in total and all folder have 100+ files to be processed] I wrote a script in which if I give the folder containing the files e.g. Section I then it would process files inside using glob.iglob function. Is it possible to write a script which can walk along directories by just entering one directory > processing file > leaving directory > entering different directory > and so on. please help. Addressing Abhisek's comment on Aragon's solution: import os folder

finding files in a dir

a 夏天 提交于 2019-11-30 23:15:45
I have a directory with a lot of files inside: pic_1_79879879879879879.jpg pic_1_89798798789798789.jpg pic_1_45646545646545646.jpg pic_2_12345678213145646.jpg pic_3_78974565646465645.jpg etc... I need to list only the pic_1_ files. Any idea how I can do? Thanks in advance. The opend dir function will help you $dir ="your path here"; $filetoread ="pic_1_"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (strpos($file,$filetoread) !== false) echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } } good luck see php.net