dir

Working with Unicode file names in VBA (using Dir, FileSystemObject, etc.)

三世轮回 提交于 2019-12-28 22:27:13
问题 I am iterating through files in a folder (which means I do not know the names in the folder), and have a file with a Polish ł character. The Dir function converts this to an l which means the filename can't be found at a later date. I've declared the var that I'm assigning the dir value to as a string. I've also tried FSO and getfolder which also has the same issue. I've also noticed the file dialog (set to folder select mode) converts the character above too. Is this a bug, or is it

Merge multiple .txt files from multiple directories in R

谁说我不能喝 提交于 2019-12-25 18:48:25
问题 Merge .txt files from different sub directories I have a folder that is filled with sub folders of past dates (01_14 for example), inside each date folder there are 11 files named 01.txt, 02.txt... How can I merge all the .txt files into one data frame, with one column with the name of the folder from where it came from and a column with the name of file from where it came from? My hierarchy would look something like this: \Data \01_14 01.txt 02.txt ... 11.txt \02_14 01.txt 02.txt ... 11.txt

Execute multiple command onto same terminal using bash script

大城市里の小女人 提交于 2019-12-25 06:59:24
问题 I am trying to run a bash script which contains few commands to execute. I want to open a terminal and execute multiple commands into it. I have written commands to set the directory path and want to make a folder there. Code : gnome-terminal --working-directory=/var/run/ gnome-terminal -e "bash -c \"sudo mkdir sphinxsearch; exec bash\"" Here, There are 2 problems : 1) Two separate terminal are opened that I don't want. I need only a single terimal where I will execute my commands. 2) sudo

Perl: Bad Symbol for dirhandle

自闭症网瘾萝莉.ら 提交于 2019-12-25 02:37:24
问题 This is my code: opendir(DIR, $directoryPath) or die "Cant open $directoryPath$!"; my @files = readdir(DIR); #Array of file names closedir (DIR) or die "Cant close $directoryPath$!"; I'm using @files to create an array of the file names within the directory for renaming later in the program. The problem is: I am getting the error "Bad Symbol for dirhandle" at the closedir line. If I don't closedir to avoid this, I don't have permission to change file names (I'm using Windows). I tried an

windows batch dir command get last modified directory starting with string

跟風遠走 提交于 2019-12-24 14:18:57
问题 I want to get the last modified directory starting with a string stringEx... in a windows batch file. For example: I have a folder containing sub-directories like this : - Directory -Subdirectory1 -Subdirectory2 -Anothersubdirectory .... I tried with this but it doesn't work: @echo off Setlocal EnableDelayedExpansion Set foundedFolder FOR /F %%i IN ('dir C:\Directory | subtsr "Anoth*" /b /ad-h /od') DO (SET a=%%i) %foundedFolder%=%a% Any ideas? 回答1: for /f "delims=" %%a in ('dir /b /ad-h /od

Batch Created Folder By Filename Part and Move

╄→гoц情女王★ 提交于 2019-12-24 11:20:03
问题 I found magoo's post and been playing around with it. I can't seem to get the DIR part to parse out the file name to create the folder and move the files to the respective folders. The following are examples of the files I'm working with: ... 800.1.gif 800.2.gif 800.3.jpg 801.1.gif 801.2.jpg 801.3.gif ... The batch should create folders 800 and 801 and move the 800.X and 801.X files respectively. I've tried FINDSTR and other masks and not having much luck. Here's magoo's original batch code

Very slow dir()

前提是你 提交于 2019-12-21 20:10:50
问题 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. 回答1: 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

MATLAB dir without '.' and '..'

大憨熊 提交于 2019-12-21 07:07:09
问题 the function dir returns an array like . .. Folder1 Folder2 and every time I have to get rid of the first 2 items, with methods like : for i=1:numel(folders) foldername = folders(i).name; if foldername(1) == '.' % do nothing continue; end do_something(foldername) end and with nested loops it can result in a lot of repeated code. So can I avoid these "folders" by an easier way? Thanks for any help! Edit: Lately I have been dealing with this issue more simply, like this : for i=3:numel(folders)

php pathinfo() expects parameter 1 to be string, array given in [duplicate]

末鹿安然 提交于 2019-12-20 07:56:22
问题 This question already has answers here : Reference - What does this error mean in PHP? (35 answers) Closed 5 years ago . I have a script that has the error-- pathinfo() expects parameter 1 to be string, array given in C:\xampp\htdocs\sitename\index.php on line 4-- , how to fix a script is <?php $dir = 'dir1/dir2/dir3/dir4/'; $phpfiles = glob($dir ."*.php"); line error ---> $pathinfo= pathinfo($phpfiles, PATHINFO_FILENAME ); foreach ($phpfiles as $phpfile){ echo '<li><a href="'.$phpfile.'">'.

How to force Matlab to read files in a folder serially?

一笑奈何 提交于 2019-12-20 03:52:52
问题 I have files in a folder that are numbered from writer_1 to writer_20 . I wrote a code to read all the files and store them in cells. But the problem is that the files are not read serially. folders = dir(Path_training); folders(ismember( {folders.name}, {'.', '..'}) ) = []; %Remove these two from list training = []; for i = 1:length(folders) current_folder = [Path_training folders(i).name '\']; . . . . . Here folders(1).name is writer_1 and folders(2).name is writer_10 I know that dir will