dir

How to create ls in windows command prompt?

限于喜欢 提交于 2019-11-28 02:53:24
I want to use ls in windows command prompt and make it run the dir command. How can I do that? You could: create a batch file called ls.bat and have it contain the dir command only add the directory where the ls.bat file exists to your PATH environment variable You could then execute ls from a command prompt. secghost You can solve this question with one simple command: echo @dir %* > %systemroot%\system32\ls.bat Make sure you run cmd.exe as admin first if you are on vista and up Its an old question but for the record: http://gnuwin32.sourceforge.net/packages/coreutils.htm Gives you ls and a

Equivalent of Python's dir in Javascript

北战南征 提交于 2019-11-27 21:00:58
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 console like firebug, chrome console, etc? There are a couple of functions which do just this in the code for ChatZilla, you'll have to check the licence properly to see if you can just rip them out and use them wherever. The relevant functions can be found at http://hg.mozilla.org/chatzilla/file/59b46c0bf716/js/lib/utils.js#l136 dumpObject and

Using SAS Macro to pipe a list of filenames from a Windows directory

眉间皱痕 提交于 2019-11-27 14:30:18
I am trying to amend the macro below to accept a macro parameter as the 'location' argument for a dir command. However I cannot get it to resolve correctly due to the nested quotes issue. Using %str(%') does not work, neither do quoting functions for some reason. The macro will work fine when the filepath has no spaces (eg C:\temp\withnospace) as the middle quotes aren't needed. However I need this macro to work for filepaths with spaces (eg 'C:\temp\with space\'). Please help! %macro get_filenames(location) filename pipedir pipe "dir &location. /b " lrecl=32767; data filenames; infile pipedir

How to check if directory exist using C++ and winAPI [duplicate]

删除回忆录丶 提交于 2019-11-27 11:06:44
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: How do you check if a directory exists on Windows in C? How do I check whether a directory exists using C++ and windows API? 回答1: well we were all n0obs at some point in time. No problem in asking. Here is a simple function which does exactly this : #include <windows.h> #include <string> bool dirExists(const std::string& dirName_in) { DWORD ftyp = GetFileAttributesA(dirName_in.c_str()); if (ftyp == INVALID_FILE

How to rename a file in Ruby?

一个人想着一个人 提交于 2019-11-27 10:15:50
问题 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 + File.extname(f)) end puts "Renaming complete." The files are moved from their initial directory to where the .rb file is located. I'd like to rename the files on the spot, without moving them. Any suggestions on what to do? 回答1: What about simply: File.rename(f, folder_path + "

How to list all folder with size via batch file

心已入冬 提交于 2019-11-27 05:17:56
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 For each folder in the list, use dir command to retrieve the size of the files under the folder @echo off setlocal disabledelayedexpansion set "folder=%~1" if not defined folder set "folder=%cd%" for /d %%a in (

How to create ls in windows command prompt?

寵の児 提交于 2019-11-27 04:59:58
问题 I want to use ls in windows command prompt and make it run the dir command. How can I do that? 回答1: You could: create a batch file called ls.bat and have it contain the dir command only add the directory where the ls.bat file exists to your PATH environment variable You could then execute ls from a command prompt. 回答2: You can solve this question with one simple command: echo @dir %* > %systemroot%\system32\ls.bat Make sure you run cmd.exe as admin first if you are on vista and up 回答3: Its an

Recursive Copy of Directory

主宰稳场 提交于 2019-11-27 01:34:03
问题 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 (is_file($source)) { return copy($source, $dest); } // Make destination directory if (!is_dir($dest)) { mkdir($dest); $company = ($_POST['company']); } // Loop through the folder $dir = dir($source); while (false !== $entry = $dir->read()) { // Skip pointers if (

Equivalent of Python's dir in Javascript

让人想犯罪 __ 提交于 2019-11-26 22:55:40
问题 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 console like firebug, chrome console, etc? 回答1: There are a couple of functions which do just this in the code for ChatZilla, you'll have to check the licence properly to see if you can just rip them out and use them wherever. The relevant functions

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

Deadly 提交于 2019-11-26 19:48:31
问题 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 object? 回答1: It gives you a dir ectory of all attributes of an object. This is not a directory as used in file systems, but the standard usage: a listing of names or data. 回答2: IIRC I named it after the DIR command in DOS. 回答3: You're retrieving a