directory

[Vue]webpack的require与require.context

女生的网名这么多〃 提交于 2020-01-04 14:26:48
1.require 1.1完整路径的require语句: require('tools'); //preset alias tools require('./js/main'); 1.2带表达式的 require 语句: 自动 创建一个上下文(context) 如果你的 require参数含有表达式(expressions),会自动创建一个上下文(context),因为在编译时(compile time)并不清楚具体是哪一个模块被导入。 如: require('./template/' + name + '.ejs'); webpack 解析 require() 的调用,提取出来如下这些信息: Directory: ./template Regular expression: /^.*\.ejs$/ 会返回template目录下的所有后缀为.ejs模块的引用,包含子目录: { "./table.ejs": 42, "./table-row.ejs": 43, "./directory/folder.ejs": 44 } 2.require.context: 手动创建一个上下文(context) require.context(directory, useSubdirectories = false, regExp = /^\.\//); directory:指定要打包的目录;

C#实现文件Move操作和文件的Copy操作

心不动则不痛 提交于 2020-01-04 12:10:48
文件移动(Move)操作和文件的复制(Copy)是C#程式开发经常遇到的方法,根据传入的源文件地址和目标文件地址参数,实现对文件的操作。实现代码如下: Move操作代码: public static void MoveFolder(string sourcePath, string destPath) { if (Directory.Exists(sourcePath)) { if (!Directory.Exists(destPath)) { //目标目录不存在则创建 try { Directory.CreateDirectory(destPath); } catch (Exception ex) { throw new Exception("创建目标目录失败:" + ex.Message); } } //获得源文件下所有文件 List<string> files = new List<string>(Directory.GetFiles(sourcePath)); files.ForEach(c => { string destFile = Path.Combine(new string[] { destPath, Path.GetFileName(c) }); //覆盖模式 if (File.Exists(destFile)) { File.Delete(destFile);

python Mac OS : os.path.getsize returns different value than du -ks?

强颜欢笑 提交于 2020-01-04 09:42:09
问题 When comparing the size of a directory with Unix and python, I have slightly different results (5% smaller with "disk usage"). Why ? (all my subfolders are readable; I work under Mac OSX Mountain lion, python version 2.7.2) Here is my code : import os, sys from commands import getstatusoutput def get_size(start_path = '.'): total_size = 0 for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: fp = os.path.join(dirpath, f) total_size += os.path.getsize(fp) return total

Powershell - Create a folder from a file name, then place that file in the folder

廉价感情. 提交于 2020-01-04 09:11:36
问题 I have a list of files say... T123_Product_1.jpg T123_Product_2.jpg T123_Product_3.jpg T456_Product_1.jpg T456_Product_2.jpg T456_Product_3.jpg etc. etc. etc. for about 900 more files What I am needing to do is create a folder based on the characters before the first underscore, but to not repeat it since there are multiple files. So in the example above, I would only want two folders named T123 and T456. Then I would need the script to place the appropriate files in the folder. I had found

Extract only folder name right before filename from full path

╄→гoц情女王★ 提交于 2020-01-04 05:59:01
问题 I have the following path filePath <- "/data/folder1/subfolder1/foo.dat" I'd like to get subfolder1 which is where foo.dat locates. I saw solutions in other languages but haven't found one in R. What is the simplest way to do it? Thank you! What I tried > basename(filePath) [1] "foo.dat" > dirname(filePath) [1] "/data/folder1/subfolder1" 回答1: This may solve: filePath <- "/data/folder1/subfolder1/foo.dat" basename(dirname(filePath)) http://www.r-fiddle.org/#/fiddle?id=IPftVEDk&version=1 回答2:

Change of directory in Fortran in a non compiler-specific way

泄露秘密 提交于 2020-01-04 02:41:07
问题 I wish to change the working directory in a Fortran 90 code. Is it possible to do this in a non compiler-specific way? Here is my code: program change_directory integer :: ierr call system("mkdir -p myfolder/") !call system("cd myfolder/") !doesn't work ierr = chdir("myfolder") if (ierr.NE.0) then write(*,'(A)') "warning: change of directory unsuccessful" end if open(unit=33,file="myfile.txt",iostat=ierr) if (ierr.EQ.0) then write(unit=33,fmt='(A)') "Test message" close(unit=33) end if end

How to get the “get info” pane in finder programmatically (Objective-c)?

♀尐吖头ヾ 提交于 2020-01-04 01:55:10
问题 we right-click a folder or file, and then we can choose "get info" option to show some info. I wonder whether we can do this through objective-c? 来源: https://stackoverflow.com/questions/18500983/how-to-get-the-get-info-pane-in-finder-programmatically-objective-c

Why do empty folders disappear when adding Visual Studio solution to TFS?

倾然丶 夕夏残阳落幕 提交于 2020-01-04 01:36:08
问题 I have this Visual Studio solution that includes a project that has a template folder tree consisting of several empty folders. When I add this solution to Team Foundation Server (TFS) using the "Source Control -> Add Solution to Source Control" menu item it doesn't add the empty folders to the TFS repository! I really need those folder to be present when the code is downloaded from TFS. Now, I know I can create the folder structure using Source Control Explorer, but since the whole project

c++ list all directories and subdirectories within in (LINUX ) [closed]

好久不见. 提交于 2020-01-03 21:08:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am new in c ++ . could someone please give me some code of how to get all directories and all it's subdirectories RECURSIVELY in LINUX. i haven't found anything on internet that could help me ( or code that works.) I need to get all files withing folder and it;s subfolder. IN UBUNTU I don't have getfiles,

Can I programmatically choose the Android layout folder?

强颜欢笑 提交于 2020-01-03 17:33:49
问题 I'm building an Android app that resizes based on the screen size using different layout folders (i.e. large, xlarge, etc.). The only problem is that I want to provide a way for users to switch between the small and large screen layouts, in case they have a pre-honeycomb tablet that doesn't recognize the xlarge tag, or the device is closer to phone size but still big enough that the user wants to use the tablet layouts. Is there a way that I can create a button to switch layout folders? I