node安装和基础

http://stackoverflow.com/questions/22504566/renaming-files-using-node-js
elon musk  13:45:44
为啥要用node重命名
Future Game Studio  13:45:51
You'll need to use fs for that: http://nodejs.org/api/fs.html

And in particular the fs.rename() function:

var fs = require('fs');
fs.rename('/path/to/Afghanistan.png', '/path/to/AF.png', function(err) {
    if ( err ) console.log('ERROR: ' + err);
});
Future Game Studio  13:46:09
这样以后所有东西自动化代码实现
Future Game Studio  13:46:35
下载重命名 改数据
Future Game Studio  13:49:58
webstorm要下载多久
elon musk  13:50:33
我用迅雷试试
elon musk  13:51:09
我都没搞清楚mac的文件路径是啥
elon musk  13:51:28
硬盘啥的
elon musk  13:51:31
文件都存哪里
elon musk  13:51:53

 

Future Game Studio  13:51:58
在你终端
Future Game Studio  13:52:08
打开iterm
Future Game Studio  13:52:16
输入open .
Future Game Studio  13:52:35
然后把这个文件夹拖到个人收藏
elon musk  13:53:09
what?
elon musk  13:53:35

 

elon musk  13:53:41
那个文件夹
elon musk  13:53:45
哪个
Future Game Studio  13:54:01
输入
Future Game Studio  13:54:04
open /.
Future Game Studio  13:54:06
open .
Future Game Studio  13:54:15
自动打开当前文件夹
elon musk  13:54:37
当前是啥意思
Future Game Studio  13:54:47


elon musk  13:55:00

Future Game Studio  13:55:01
终端所处文件夹
Future Game Studio  13:55:12
cd ..
Future Game Studio  13:55:22
上级目录
Future Game Studio  13:55:27
然后再open .
Future Game Studio  13:55:36
就到上级了
Future Game Studio  13:55:47
然后把你那个文件夹拖到个人收藏
Future Game Studio  13:55:53

 


Future Game Studio  13:56:03
以后个人收藏就有你终端那个目录了
elon musk  13:56:10

 

 


elon musk  13:56:24
open . 打开了这个
Future Game Studio  13:56:55
cd ..
Future Game Studio  13:56:58
有空格
elon musk  13:57:16

 

 

 
open .
Future Game Studio  13:57:46
把ma文件夹
Future Game Studio  13:57:50
拖到个人收藏
 


 
 
elon musk  13:58:32
搞定
elon musk  13:58:35
为啥要这样
Future Game Studio  13:58:38
这样你的终端
Future Game Studio  13:58:42
跟你的mac
Future Game Studio  13:58:44
就对应了
Future Game Studio  13:58:53
你打开终端就是ma文件夹
Future Game Studio  13:58:54
明白?
elon musk  13:59:04

Future Game Studio  13:59:10
将来你用webstorm
Future Game Studio  13:59:12
选文件夹
elon musk  13:59:14
个人收藏是个啥意思
Future Game Studio  13:59:15
就能看到ma了
Future Game Studio  13:59:17
之前看不到
elon musk  13:59:28

Future Game Studio  13:59:31
上传 下载文件就能看到ma了
 
Future Game Studio  14:02:32
先看fs代码
Future Game Studio  14:02:46
var fs = require('fs');
fs.rename('/path/to/Afghanistan.png', '/path/to/AF.png', function(err) {
    if ( err ) console.log('ERROR: ' + err);
});
Future Game Studio  14:02:49
第一行
Future Game Studio  14:02:56
载入fs库
Future Game Studio  14:03:02
然后用fs的函数rename
elon musk  14:03:38
比如我rename这个
elon musk  14:03:39

 

elon musk  14:03:42
0711
Future Game Studio  14:04:34
文件跟文件夹不一样。。
Future Game Studio  14:04:38
先学文件
elon musk  14:05:36
我试试哈
Future Game Studio  14:05:55
等webstrom下载完
Future Game Studio  14:06:01
你现在没法run node
 
Future Game Studio  14:12:58
下完再webstorm
Future Game Studio  14:13:00
直接run
Future Game Studio  14:13:07
js文件
 
 
 
 
 
 
 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值