Questions tagged [dir]

Abbreviation for a directory, a virtual container within a digital file system.

Also a command equivalent to ls in Unix and found in operating systems such as DOS, VMS, and MS Windows.

446 questions
217
votes
6 answers

Command to list all files in a folder as well as sub-folders in windows

I tried searching for a command that could list all the file in a directory as well as subfolders using a command prompt command. I have read the help for "dir" command but coudn't find what I was looking for. Please help me what command could get…
user1760178
  • 5,637
  • 5
  • 23
  • 54
137
votes
7 answers

Is there a way to delete created variables, functions, etc from the memory of the interpreter?

I've been searching for the accurate answer to this question for a couple of days now but haven't got anything good. I'm not a complete beginner in programming, but not yet even on the intermediate level. When I'm in the shell of Python, I type:…
funghorn
  • 1,607
  • 2
  • 13
  • 12
118
votes
19 answers

How to create ls in windows command prompt?

I want to use ls in windows command prompt and make it run the dir command. How can I do that?
aF.
  • 58,798
  • 40
  • 127
  • 191
60
votes
5 answers

How to rename a file in Ruby?

Here's my .rb file: puts "Renaming files..." folder_path = "/home/papuccino1/Desktop/Test" Dir.glob(folder_path + "/*").sort.each do |f| filename = File.basename(f, File.extname(f)) File.rename(f, filename.capitalize +…
delete
55
votes
4 answers

Why is 'dir()' named 'dir' in python?

In Python there is a built-in function called dir. This is used to get a list of all the attributes for an object. I understand what it does, but I am confused about why it is called dir. How is this name related to getting the attributes from an…
TM.
  • 94,986
  • 30
  • 119
  • 125
53
votes
7 answers

Equivalent of Python's dir in Javascript

when I write Python code from the interpreter I can type dir() to have a list of names defined in the current scope. How can achieve to have the same information, programmatically, when I develop Javascript code from a browser using an interactive…
Paolo
  • 16,171
  • 20
  • 78
  • 110
36
votes
3 answers

Copying a file from one directory to another with Ruby

Hey I'm trying to move multiple files from one folder to another. In the FileUtils line I am trying to search through all of the 4 character folders in the destination folder and then paste the file in the folder with the same base name as the…
1dolinski
  • 677
  • 3
  • 9
  • 24
35
votes
1 answer

How to use __dir__?

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/ …
JosefPP
  • 392
  • 1
  • 3
  • 11
34
votes
4 answers

list the subfolders in a folder - Matlab (only subfolders, not files)

I need to list the subfolders inside a folder using Matlab. If I use nameFolds = dir(pathFolder), I get . and .. + the subfolder names. I then have to run nameFolds(1) = [] twice. Is there a better way to get the subFolder names using Matlab? …
Maddy
  • 2,478
  • 13
  • 43
  • 62
26
votes
2 answers

Windows command line search for exact extension with dir

When I do a search: dir /b /s *.txt I get all files/folders with the extension .txt. But I also get them when they have an extension like .txtx. How can I search for the exact extension?
Marc
  • 261
  • 1
  • 3
  • 3
26
votes
3 answers

Members of Dirent structure

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…
Naruto
  • 1,620
  • 7
  • 28
  • 37
24
votes
14 answers

Recursive Copy of Directory

On my old VPS I was using the following code to copy the files and directories within a directory to a new directory that was created after the user submitted their form. function copyr($source, $dest) { // Simple copy for a file if…
Jason
  • 241
  • 1
  • 2
  • 3
24
votes
7 answers

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

dir/b > files.txt I guess it has to be done in PowerShell to preserve unicode signs.
24
votes
9 answers

MATLAB dir without '.' and '..'

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 …
jeff
  • 11,519
  • 28
  • 67
  • 126
23
votes
1 answer

How do I read numpy source?

I built it myself on Python 3.3, but I can't for the life of me find the class definition of numpy.array(). I've looked all through the code and even found the core C files, but where is the dang array class?? Can anyone tell me what directory to…
mrKelley
  • 2,925
  • 1
  • 17
  • 28
1
2 3
29 30