dir

finding files in a dir

≯℡__Kan透↙ 提交于 2019-12-19 03:59:10
问题 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. 回答1: 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)

Search by date using command line

落爺英雄遲暮 提交于 2019-12-18 12:56:19
问题 Is there any way to search for files in a directory based on date? I want to find all files with created date greater than a specific date, is it possible to do it with dir command? 回答1: dir by itself can not filter by date, but you can parse the output of dir using for command. If in your country dir prints the date in YMD format, then you only need to compare it with given date. If the order of date parts is different, then you have to use another for command to parse the date and change it

How to use __dir__?

亡梦爱人 提交于 2019-12-18 12:11:17
问题 I want to use __dir__ . However, I can't find any good tutorial on how to set it up. I have my htdocs in Dropbox. Does it work something like this? define(__DIR___, 'd:documents/dropbox/yolo/swag/htdocs/myproject/test/newtest/ testphp/test_new/testincludes/1/new_folder/') That is the directory where my project is located and it has sub folders. I want to include a file into another file that is in the parent folder. Should I then just type: include'__DIR__/warlock.php'; Or do I have to type

VBA List all files (fast way) in subfolders without FileSystemObject

蓝咒 提交于 2019-12-17 20:37:09
问题 I'm searching for a way for fast listing all files from subfolders of folder. Approach based on FileSystemObject is too slow - it takes ~6 minutes for listing 416 filenames from a network drive (intranet), as I understand Dir() function doesn't allow for looping throught subfolders. 回答1: Use CMD instead: Sub SO() Const parentFolder As String = "C:\Users\bloggsj\folder\" '// change as required, keep trailing slash Dim results As String results = CreateObject("WScript.Shell").Exec("CMD /C DIR "

Members of Dirent structure

不打扰是莪最后的温柔 提交于 2019-12-17 18:04:42
问题 I have started working with dirent.h library and I came across a very useful member of "struct dirent" structer which struct dirent *p->d_name in my book. But unfortunatly it doesn't states any other members of this structure; I was wondering what else are the members of this structure and what are they used for? Regards 回答1: The structure, struct dirent refers to directory entry. http://www.gnu.org/software/libc/manual/html_node/Directory-Entries.html In linux it is defined as: struct dirent

How to list all folder with size via batch file

时光怂恿深爱的人放手 提交于 2019-12-17 07:38:43
问题 I want a simple solution for list of folders and size of them in either txt or csv format. I use this code for folder list dir C:\Temp\*.* /b /a:d > C:\folderList.txt current output <<folderList.txt>> folder1 folder2 folder3 desired output <<folderList.txt>> folder1 # 100 MB folder2 # 30 MB folder3 # 110 MB Simply it would generate the size of each folder.. How can I proceed?? any help 回答1: For each folder in the list, use dir command to retrieve the size of the files under the folder @echo

How to list all folder with size via batch file

﹥>﹥吖頭↗ 提交于 2019-12-17 07:34:59
问题 I want a simple solution for list of folders and size of them in either txt or csv format. I use this code for folder list dir C:\Temp\*.* /b /a:d > C:\folderList.txt current output <<folderList.txt>> folder1 folder2 folder3 desired output <<folderList.txt>> folder1 # 100 MB folder2 # 30 MB folder3 # 110 MB Simply it would generate the size of each folder.. How can I proceed?? any help 回答1: For each folder in the list, use dir command to retrieve the size of the files under the folder @echo

Python dir() not displaying all modules in a package

隐身守侯 提交于 2019-12-14 02:26:20
问题 I'm using python 2.6 and I'm seeing somewhat weird behavior with the dir() function. I'm trying to import all the modules from a directory/package for a unittest but when I do a dir() on on the folder, I don't get all the modules in that directory. Sample directory structure: |-mod_dir\ |---__init__.py |---modA.py |---modB.py |---modC.py | |-mod_tests\ |---__init__.py |---test.py Sample test.py: import mod_dir for obj in dir(mod_dir): print obj Unfortunately, at this point I only get

usage of __DIR__ in a class

一曲冷凌霜 提交于 2019-12-14 00:58:16
问题 I'm writing a very simple PHP application that returns the path of the file with a slight modification. this is my code: <?php class abc { private $path = __DIR__ . DIRECTORY_SEPARATOR. 'moshe' . DIRECTORY_SEPARATOR; function doPath() { echo $this->path; } } $a = new abc(); $a->doPath(); I get the error: PHP Parse error: syntax error, unexpected '.', expecting ',' or ';' in /mnt/storage/home/ufk/1.php on line 4 Parse error: syntax error, unexpected '.', expecting ',' or ';' in /mnt/storage

view .m files in a folder (including subFolders) in MATLAB

浪尽此生 提交于 2019-12-13 07:17:10
问题 I have a Folder Factors inside Project folder. (all inside MyDocuments/Matlab). I need the list of all .m files in the folder FACTORS. Factors has subFolders and these subFolders hold all the .m files. Any suggestions? Directory Design -> Project... Factors ... etc subFol1 (has .m files) subFol2 (has .m files) ... 回答1: I have solved a similar problem.On Windows platforms, ,Like this: pathName='.... \FACTORS';%your path [stat path]=dos(['dir ' pathName '\*.m /s /B >path.txt'] ); name