dir

dot slash vs nothing. What is the difference and what's better to use?

﹥>﹥吖頭↗ 提交于 2021-02-16 13:45:09
问题 Just for curiosity. What is the better method to use and what is the difference between them ? <link rel=stylesheet href="./css/css.css"> vs <link rel=stylesheet href="css/css.css"> 回答1: In a relative URI, there is no difference between them. Going without the ./ will save you 2 bytes, so it is marginally better. In a UNIX style shell, leaving the ./ off will search $PATH while including it will search the current directory. Some people might be including the ./ out of habit from working on

Creating a HTML Table with Python

穿精又带淫゛_ 提交于 2021-01-29 08:28:03
问题 I'm stuck on creating a HTML Table for this code here. have to try to output all the dir() of list , dict , tuple , str , int , and float in a HTML table with a limit of 7 column per row. I've tried many things and is unable to produce that. I kept getting an internal server error when i try it out. I think i'm doing the tags from for the table or i'm missing something but still haven't figured it out. #!/usr/local/bin/python3 print('Content-type: text/html\n') d_list = [] d_dict = [] d_tuple

Encode or somthing to escape slash (/) input in php?

守給你的承諾、 提交于 2020-01-30 12:11:14
问题 I'm stack here. I want to create a file and i use title_input as file_name, but i have problem when create the file to specific folder. Example: $file_name="Multi purpose Day/Night Security"; $myfile = fopen($_SERVER['DOCUMENT_ROOT']."/myweb/product/".$file_name.".php", "wb") or die("Unable to open file!"); Error: Warning: fopen(C:/Program Files/xampp/htdocs/myweb/product/Multi-Purpose Day/Night Security.php): failed to open stream: No such file or directory in C:\Program Files\xampp\htdocs

PHP recursive delete function

半世苍凉 提交于 2020-01-11 09:01:30
问题 I wrote recursive PHP function for folder deletion. I wonder, how do I modify this function to delete all files and folders in webhosting, excluding given array of files and folder names (for ex. cgi-bin, .htaccess)? BTW to use this function to totally remove a directory calling like this recursive_remove_directory('path/to/directory/to/delete'); to use this function to empty a directory calling like this: recursive_remove_directory('path/to/full_directory',TRUE); Now the function is function

Exclude multiple folders with Dir command

拈花ヽ惹草 提交于 2020-01-05 10:10:54
问题 I had search thru the forum with excluding multiple files while using DIR command. But didn't find what i really needed. Some are even with PHP or VBS, really don't know how they works. What I'm trying to do is *DIR*ing all profile folders and also excluding certain default folders, this is a part of showing what and how many users are having profiles on that computer. I will explain a bit more because i may not fully be understood what my needs are. If i use the DIR without findstr . DIR /A

Octave: Load all files from specific directory

人盡茶涼 提交于 2020-01-02 16:25:21
问题 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

Why does dir *.txt return *.txtf also?

不羁岁月 提交于 2019-12-30 12:12:05
问题 No doubt this has been answered already :/ I'm not certain how to word this. I just want the file one.txt to return by what I thought would be dir *.txt Here are some examples to show that it doesn't behave like I had thought. dir *.txt one.txt one.txtf dir *txt one.txt one.txtf dir *txtf one.txtf dir *tx? one.txt one.txtf dir *.??? one.txt one.txtf dir one.??? one.txt dir *"."??? one.txt one.txtf 回答1: EDITED In short - by definition the DIR command works as you're implying so it's one of

PHP Get dimensions of images in dir

假装没事ソ 提交于 2019-12-30 11:18:06
问题 I have a huge ammount of photos that need sorting through. I need to know the dimensions of each photo in order to know or it needs re-sizing. As a programmer I'm convinced there must be a quicker way of doing this. I got quite far. The following code reads the dir and all the sub dirs. But the moment I try to extract the dimensions the loop halts at 8% of all the pictures that need checking. Could it be PHP is not allowed to do more calculations? What is going on!? This is how far I got:

Why does Ruby seem to access files in a directory randomly?

杀马特。学长 韩版系。学妹 提交于 2019-12-30 08:59:10
问题 Is this by design? Here's the code: class FileRenamer def RenameFiles(folder_path) files = Dir.glob(folder_path + "/*") end end puts "Renaming files..." renamer = FileRenamer.new() files = renamer.RenameFiles("/home/papuccino1/Desktop/Test") puts files puts "Renaming complete." It seems to be fetching the files is random order, not as they are displayed in Nautilus. Is this by design? I'm just curious. 回答1: The order should be the same every time on a particular OS, however it is different

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

核能气质少年 提交于 2019-12-29 20:40:23
问题 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? Thanks. 回答1: Use isdir field of dir output to separate subdirectories and files: d = dir(pathFolder); isub = [d(:).isdir]; %# returns logical vector nameFolds = {d(isub).name}'; You can then remove . and .. nameFolds(ismember(nameFolds,{'.','..'})) = [];