dir

Octave: Load all files from specific directory

醉酒当歌 提交于 2019-12-06 07:06:58
I used to have Matlab and loaded all txt-files from directory "C:\folder\" into Matlab with the following code: myFolder = 'C:\folder\'; filepattern = fullfile(myFolder, '*.txt'); files = dir(filepattern); for i=1:length(files) eval(['load ' myFolder,files(i).name ' -ascii']); end If C:\folder\ contains A.txt, B.txt, C.txt, I would then have matrices A, B and C in the workspace. The code doesn't work in octave, maybe because of "fullfile"?. Anyway, with the following code I get matrices with the names C__folder_A, C__folder_B, C__folder_C. However, I need matrices called A, B, C. myFolder = 'C

Batch script to list folders but exclude specific folders

烂漫一生 提交于 2019-12-06 03:15:09
问题 I want this script to list all folders that contains "deleted" in the folder name but not if they is in a folder called "done". For exampel: list the folder if it's in C:\temp and if it's in C:\temp\random_folder_name but not not if it's in C:\temp\done dir /s "C:\temp" | findstr "\deleted" short story, exclude all folders named "done" and their content. 回答1: You are almost there. Findstr /v returns all lines, that do not contain the string dir /ad will only show directories (Atrribut

listing files in folder showing index.php

懵懂的女人 提交于 2019-12-05 23:13:42
I have this code, but it is showing the index.php itself How can I filter *.php files? <?php if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $thelist .= '<LI><a href="'.$file.'">'.$file.'</a>'; } } closedir($handle); } ?> <P>Dir:</p> <UL> <P><?=$thelist?></p> </UL> Also is there a way to sort them by modification or creation time? Here's another that uses ksort or krsort functions (tested). (See comments in code.) <?php // you can add to the array $ext_array = array(".htm", ".php", ".asp", ".js"); //list of extensions not

Find files of multiple extensions batch

风格不统一 提交于 2019-12-05 17:41:34
I'm trying to search for files of multiple under a specific directory. I know that if I wish to search for all .exe files under C:\Test , I do the following: set FoundFiles=dir /b /s C:\Test\*.exe But, what I wish to search for all .exe and .txt files under C:\Test ? Is it possible in the same way? I tried the following: dir /b /s C:\Test\*.exe *.txt It works in cmd, however, when I do this: set FoundFiles=dir /b /s C:\Test\*.exe *.txt It doesn't work. Is it even possible? Marius This should work dir /b /s *.exe /s *.txt 来源: https://stackoverflow.com/questions/16814470/find-files-of-multiple

How can I download a file to a specific directory?

被刻印的时光 ゝ 提交于 2019-12-05 17:18:57
I have been recently trying to make a program in python that downloads files to a specific directory. I am using Ubuntu and so far i have this import os import getpass import urllib2 y = getpass.getuser() if not os.access('/home/' + y + '/newdir/', os.F_OK): print("Making New Directory") os.mkdir('/home/' + y + '/newdir/') url = ("http://example.com/Examplefile.ex") file_name = url.split('/')[-1] u = urllib2.urlopen(url) f = open(file_name, 'wb') meta = u.info() file_size = int(meta.getheaders("Content-Length")[0]) print "Downloading: %s Bytes: %s" % (file_name, file_size) file_size_dl = 0

异常:Attempted to lock an already-locked dir svn:

六眼飞鱼酱① 提交于 2019-12-05 06:22:30
今天用myeclipse上svn更新代码发现报一个异常: Attempted to lock an already-locked dir svn: Working copy 'D:\xxxx\xxxx-webapp' locked 很明显都知道路径: D:\xxxx\xxxx-webapp 锁着了 找到 D:\xxxx\右键 操作如图 然后从新启动tomcat 就ok了!!!!! 来源: oschina 链接: https://my.oschina.net/u/152736/blog/94168

Batch file that returns folder size

陌路散爱 提交于 2019-12-04 20:49:32
问题 I'm having space issues on my Vista machine and need to figure out what's taking up so much space. I would like to write a simple batch file that returns all folders under C: and the size of each folder. The dir command doesn't appear to return folder size. Unfortunately we don't have admin rights and can't install a third party application and we have other users in our group that also need this information. 回答1: I'd have a look at this thread for some clues as to how to achieve the

equivalent of (dir/b > files.txt) in PowerShell

别等时光非礼了梦想. 提交于 2019-12-04 15:42:36
问题 dir/b > files.txt I guess it has to be done in PowerShell to preserve unicode signs. 回答1: Get-ChildItem | Select-Object -ExpandProperty Name > files.txt or shorter: ls | % Name > files.txt However, you can easily do the same in cmd : cmd /u /c "dir /b > files.txt" The /u switch tells cmd to write things redirected into files as Unicode. 回答2: Get-ChildItem actually already has a flag for the equivalent of dir /b : Get-ChildItem -name (or dir -name ) 回答3: In PSH dir (which aliases Get-ChildItem

Very slow dir()

二次信任 提交于 2019-12-04 12:19:34
When there are many files, around 4000, dir() function is very slow. My guess is it creates a structure and filling in the values in an inefficient way. Are there any fast and elegant alternatives to using dir() ? Update: Testing it in 64 Bit, Windows 7 with MATLAB R2011a. Update 2: It takes around 2 seconds to complete. Which CPU / OS are you using? I just tried it on my machine with a directory with 5000 files and it's pretty quick: >> d=dir; >> tic; d=dir; toc; Elapsed time is 0.062197 seconds. >> tic; d=ls; toc; Elapsed time is 0.139762 seconds. >> tic; d=dir; toc; Elapsed time is 0.058590

Batch script to list folders but exclude specific folders

北城以北 提交于 2019-12-04 07:44:55
I want this script to list all folders that contains "deleted" in the folder name but not if they is in a folder called "done". For exampel: list the folder if it's in C:\temp and if it's in C:\temp\random_folder_name but not not if it's in C:\temp\done dir /s "C:\temp" | findstr "\deleted" short story, exclude all folders named "done" and their content. You are almost there. Findstr /v returns all lines, that do not contain the string dir /ad will only show directories (Atrribut=Directory) dir /s /ad "C:\temp" | findstr "\deleted" | findstr /v "\done" dir /s "C:\temp" | findstr "\deleted"