directory

How to read all files in one folder and apply a function over them in python?

喜欢而已 提交于 2020-04-17 04:05:29
问题 I would like to run a function over all files in one folder and create new files out of them. I have put the code for one file bellow. I would appreciate it if you kindly help me. def newfield2(infile,outfile): output = ["%s\t%s" %(item.strip(),2) for item in infile] outfile.write("\n".join(output)) outfile.close() return outfile infile = open("E:/SAGA/data/2006last/325125401.all","r") outfile = open("E:/SAGA/data/2006last/325125401_edit.all","r") I would like to change all the files in the

List all folders in directory (PHP) [duplicate]

若如初见. 提交于 2020-04-16 05:25:09
问题 This question already has answers here : PHP Get all subdirectories of a given directory (16 answers) Closed 2 years ago . How can I make my code only display links to the folders and not the files in the directory? $d = dir("."); echo "<ul>"; while(false !== ($entry = $d->read())) { echo "<li><a href='{$entry}'>{$entry}</a></li>"; } echo "</ul>"; $d->close(); 回答1: $d = dir("."); echo "<ul>"; while (false !== ($entry = $d->read())) { if (is_dir($entry) && ($entry != '.') && ($entry != '..'))

List all folders in directory (PHP) [duplicate]

半世苍凉 提交于 2020-04-16 05:24:29
问题 This question already has answers here : PHP Get all subdirectories of a given directory (16 answers) Closed 2 years ago . How can I make my code only display links to the folders and not the files in the directory? $d = dir("."); echo "<ul>"; while(false !== ($entry = $d->read())) { echo "<li><a href='{$entry}'>{$entry}</a></li>"; } echo "</ul>"; $d->close(); 回答1: $d = dir("."); echo "<ul>"; while (false !== ($entry = $d->read())) { if (is_dir($entry) && ($entry != '.') && ($entry != '..'))

Is there anyway to reset the current working directory in Julia?

与世无争的帅哥 提交于 2020-04-13 07:41:12
问题 Suppose the current working directory is C:\ (the directory where the .jl file is saved), and then I switch the cwd to some subfolders to perform some tasks. Is there anyway of directly resetting the cwd back to C:\ after that, i.e. the initial cwd? Or alternatively, is there anyway of locating the directory where the .jl file being run is located, independent of the current working directory? (Without saving the cwd as a variable beforehand) 回答1: You can use the do keyword together with the

文件夹复制

≯℡__Kan透↙ 提交于 2020-04-08 11:02:07
/// <summary> /// 复制文件夹 /// </summary> /// <param name="SourcePath">源路径</param> /// <param name="DestinationPath">目标路径</param> /// <param name="overwriteexisting">是否覆盖现有</param> /// <returns></returns> private static bool CopyDirectory(string SourcePath, string DestinationPath, bool overwriteexisting) { bool ret = false; try { SourcePath = SourcePath.EndsWith(@"\") ? SourcePath : SourcePath + @"\"; DestinationPath = DestinationPath.EndsWith(@"\") ? DestinationPath : DestinationPath + @"\"; if (Directory.Exists(SourcePath)) { if (Directory.Exists(DestinationPath) == false) Directory

常用Linux操作命令

孤街醉人 提交于 2020-04-07 13:54:48
# --------------------- Linux basic ------------------------------ # file name: linux_basic # author : # date : 2014-3-25 # contact : QQ : # email : # summary : Linux basic command operation # -------------------- Linux basic ------------------------------- # ------ generic symbol ------------------------------------------ / : root directory ~ : usr directory ./ : current directory path .. : up directory path !cmd : invoke last command & : run job in background # --- create a linux user and group ----------------------------- adduser user_name : you must have root privilege passwd user_name :

oracle 数据泵

你。 提交于 2020-04-07 07:42:10
Oracle 数据库 导入导出工具,可以使用exp/imp,但这是比较早期的工具。本文主要介绍数据泵expdp/impdp工具的使用。 1、建立数据泵目录 使用数据泵需要先建directory create directory dir_back as 'e:\app\back' (删除目录:drop directory dir ) 2、查看建立的目录 Select * from dba_directories 3、赋权 Grant read,write on directory dir_back to sxybyj 4、导库 expdp sxybyj/sxybyj@orcl directory=dir_back dumpfile=sxybyj.dmp 导出数据 1)按用户导 expdp scott/tiger@orcl schemas=scott dumpfile=expdp.dmp DIRECTORY=dir logfile=expdp.log 2)并行进程parallel expdp scott/tiger@orcl directory=dir dumpfile=scott3.dmp parallel=40 job_name=scott3 3)按表名导 expdp scott/tiger@orcl TABLES=emp,dept dumpfile=expdp.dmp

Oracle数据泵

纵饮孤独 提交于 2020-04-06 13:33:32
要使用数据泵必须先创建数据库目录 数据库目录只允许sys 创建 普通用户使用 必须授权 假设scott 用户是导出导入用户 SQL> ! mkdir dp_dir SQL> create directory dp_dir as '/home/oracle/dp_dir'; Directory created. SQL> grant read,write on directory dp_dir to scott; Grant succeeded. 数据泵导出方法: 导出scott 用户 expdp 导出案例1,按表导出 expdp scott/tiger directory= dp_dir dumpfile=tab.dmp logfile=scott.log tables=dept,emp 导出案例2,按用户导出 expdp scott/tiger directory= dp_dir dumpfile=dumpscott.dmp schemas=scott 导出案例3,全库导出,且并行导出 expdp scott/tiger directory= dp_dir dumpfile=full.dmp parallel=4 full=y 备份文件在/home/oracle/dp_dir/ 目录下 数据泵导入方法: 导入scott 用户 Impdp 将文件拷贝到/home/oracle/dp

wamp 配置

▼魔方 西西 提交于 2020-04-06 00:19:30
我的安装环境及版本: apache2.4+mysql5.5.19+php5.5.1+phpmyadmin3.5.4 apache, mysql,php 按顺序安装完后开始配置: 1.httpd.conf配置: DocumentRoot "E:/wamp/apache/htdocs" 项目默认的存放路径,可根据实际情况修改,注:如此节点修改则相应的Directory节点的目录也需进行修改。 <Directory " E:/wamp/apache/htdocs "> AddType application/x-httpd-php .php DirectoryIndex index.php index.html 注意:Apache Windows配置文件httpd.conf中要求的目录分隔符是用斜线”/”,而PHP Windows配置文件php.ini中书写目录时要求的是反斜线”\”,不要弄混了。 配置测试,在DocumentRoot节点所指定的目录中创建index.php 打印php配置信息。 开启重写,支持 .htaccess (可选) : LoadModule rewrite_module modules/mod_rewrite.so 去掉注释 <Directory /> AllowOverride none Require all denied </Directory> 改为:

WampServer3.0.6的安装配置

一个人想着一个人 提交于 2020-04-05 22:09:53
1.WampServer:window+apache+mysql+php的版本信息 wampserver3.0.6_x64_apache2.4.23_mysql5.7.14_php5.6.25-7.0.10 安装在F:\wamp64目录下。 2.关于WampServer的服务控制面板的修改   1)自定义网站根目录:     http.conf文件和httpd-vhosts.conf下找到DocumentRoot:       DocumentRoot "${INSTALL_DIR}/www" 修改为:DocumentRoot "你想要的路径"       <Directory "${INSTALL_DIR}/www/"> 修改为:<Directory "你想要的路径">     新版本的WampServer的配置文件,提供了很多全局定义的默认配置!就相当于把上述的配置做如下修改:       DocumentRoot "${INSTALL_DIR}/www" 修改为:DocumentRoot "${INSTALL_DIR}/Demo"       <Directory "${INSTALL_DIR}/www/"> 修改为:<Directory "${INSTALL_DIR}/Demo">     在http.conf文件中关于${INSTALL_DIR