一些文件操作的函数命令

列出一些IDL中常用的文件操作函数命令。

  1. FILE_MKDIR . 语法:FILE_MKDIR, File1 [,… FileN]
    创建给定目录。若省略绝对路径,则在当前路径下创建。
compile_opt idl2

File_counts = 2
Dest_Dir = 'D:\LG Files\Code\'

CD, Dest_Dir

For num = 1, File_counts Do Begin
  FILE_MKDIR, '文件夹创建测试 ' + strtrim(string(num),2) + ' 文件操作命令'
  ; strtrim()去除字符串中的空格, 参看文档。
EndFor

Print, 'End of Procedure!'

End
  1. FILE_COPY . 语法:FILE_COPY, SourcePath, DestPath [, /OVERWRITE]
    语句中的其他关键字详见帮助手册。
Rename the file backup.dat to primary.dat in the current working directory:

**FILE_MOVE, 'backup.dat', 'primary.dat'**

Create a subdirectory named BACKUP in the current working directory and move all .pro files, makefile, and mydata.dat into it:

**FILE_MKDIR, 'BACKUP'
FILE_MOVE, ['*.pro', 'makefile', 'mydata.dat'], 'BACKUP'**
  1. FILE_DELETE. 语法:FILE_DELETE, File1[,… Filen]
    The FILE_DELETE procedure deletes a file or empty directory。
  2. FILE_DIRNAME. Returns the dirname of a file path。
    语法:Result = FILE_DIRNAME(Path [, /MARK_DIRECTORY])
    关键字的效果如下:
ENVI> print, FILE_DIRNAME('D:\LG Files\Code\temp.xls')
D:\LG Files\Code
ENVI> print, FILE_DIRNAME('D:\LG Files\Code\temp.xls',/MARK_DIRECTORY)
D:\LG Files\Code\
  1. FILE_GUNZIP. Uncompresses a given GZIP input file or files, and saves the uncompressed data into a new file.
    语法:FILE_GUNZIP, File [, FileOut] [, /DELETE] ,[/VERBOSE]

  2. FILE_GZIP. Compresses a given input file (or files) using the DEFLATE compression algorithm, and saves the resulting compressed data in the GZIP file format into a new file or to memory.
    语法:FILE_GZIP, File [, FileOut] [, /DELETE],[/VERBOSE]

  3. FILE_ZIP. compresses a given set of input files and directories into the PKWARE ZIP file format, using the DEFLATE compression algorithm for all files within the ZIP.
    语法:FILE_ZIP, Files [, FileOut] [, /VERBOSE]

  4. FILE_UNZIP. Uncompresses ZIP files.
    语法:FILE_UNZIP, File [, DirectoryOut] [, /VERBOSE]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值